Stencil shadow flickering on entities near camera

BlitzMax Forums/MiniB3D Module/Stencil shadow flickering on entities near camera

RustyKristi(Posted 2016) [#1]
I noticed there is a lot of flickering going on when I move/turn my camera near meshes/entities with shadows. This happens more than 50% of the time and it looks like artifacts on the mesh surfaces.


RemiD(Posted 2016) [#2]
If it is the same problem that i noticed with Blitz3d and DSS, this is something which only happens on some low end graphics cards, and i have not found a solution to avoid this...

Similar issues can be solved by decreasing the rapport between the min camerarange and the max camerarange (1:1000 seems ok, for example 0.1,100 or 1,1000)
or by increasing the distance between the triangles which have the same normals of one surface and another surface.


markcw(Posted 2016) [#3]
You'd need to provide an example of this as I can't follow exactly what you're doing.


RustyKristi(Posted 2016) [#4]
Thanks RemiD and munch. I did use .1, 1000 and 1,1000 for the range but still having the same problem.

Ok I will post my sample code if you would like to take a crack on it. It's not really a big issue but it would surely help a lot. Be right back.


RustyKristi(Posted 2016) [#5]
Hey munch, I'm out of my workspace atm so definitely I can post the sample later today. In the meantime, while doing some research of my own, I did found some topic on what seems to be related to z-fighting. I also forgot to mention it's also a self shadowed thing and not the casted shadows.

Here's the thread from GameDev


GuentherKrass wrote:

if you're experiencing flickering on selfshadowed objects when using the zfail-algorithm, then you've probably got to adjust the polygon-offset (glPolygonOffset(..., ...) and glEnable(GL_POLYGON_OFFSET_FILL)) for the frontfacing caps.

If you're missing the offset, then your front cap and original geometry are on exactly the same points --> z-fighting! Adjust the values of glPolygonOffset(..., ...) so that the cap is rendered behind the original object (away from the camera). I think glPolygonOffset(1.0, 1.0) will do.



http://www.gamedev.net/topic/418913-stencil-shadow-volume-flickering/?view=findpost&p=3790950

thanks.