Flickering in stencil shadow

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Proxx
Posts: 6
Joined: Sat Mar 02, 2013 3:57 pm

Flickering in stencil shadow

Post by Proxx »

Hello,

I am currently trying out the stencil shadow code from example L12. I successfully got the code running in my application (really easy to use) but I must have missed something. Here is a screenshot:

Image

The problem: small flickering pixels in the shadow. If I place the camera near the shadow, the light pixels vanish, but if I get farther away, the flickering gets stronger and stronger.
Besides of this, I had to set the parameter clearStencilBuffer to true when calling DrawStencilShadow(). The example is somehow running without setting this. How does it come?
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Flickering in stencil shadow

Post by Mel »

That is due to how stencil shadows work in Irrlicht. those small flickers are precission problems when extruding the volumes for the shadows. The closer, the more precise, hence, the flickers dissapear. The least triangles, the better with the stencil shadows.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Flickering in stencil shadow

Post by hybrid »

Can also be small seams in the mesh, where vertices are not shared, but duplicated. Still precision problems, but more easily fixable with an improved mesh (or a simplified shadow mesh used as replacement for the original one)
Proxx
Posts: 6
Joined: Sat Mar 02, 2013 3:57 pm

Re: Flickering in stencil shadow

Post by Proxx »

Thank you. I will try to use a simplified model for the shadow volume.
Post Reply