Sign in to follow this  
Prune

Arrrgh! Shadow volume problem... help please

Recommended Posts

http://i10.tinypic.com/4vs4sbq Some of the shadow intersections, instead of forming a union, cancel each other... and I don't know why or how to handle it (floor is a white plane, light is directional from [10, 20, 10]). It's Z-pass since no object is behind the viewer. First pass: // Draw dimly lit objects Shadowing pass: glPushAttrib(GL_ALL_ATTRIB_BITS); glDisable(GL_LIGHTING); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); glShadeModel(GL_FLAT); glDepthMask(GL_FALSE); glDepthFunc(GL_LESS); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(0.0f, 2.0f); glDisable(GL_CULL_FACE); glActiveStencilFaceEXT(GL_FRONT); glStencilFunc(GL_ALWAYS, 0, ~0); glStencilOp(GL_KEEP, GL_KEEP, GL_DECR_WRAP_EXT); glActiveStencilFaceEXT(GL_BACK); glStencilFunc(GL_ALWAYS, 0, ~0); glStencilOp(GL_KEEP, GL_KEEP, GL_INCR_WRAP_EXT); glEnable(GL_STENCIL_TEST_TWO_SIDE_EXT); // Draw extruded shadow volumes, no cap just 0.0 homogeneous coordinate Last pass: glEnable(GL_LIGHTING); glStencilFunc(GL_EQUAL, 0, ~0); glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // Draw lit objects

Share this post


Link to post
Share on other sites
Hello,

It's been a while since I've used the stencil functions, but try incrementing first and then decrementing. Then use GL_GEQUAL for the glStencilFunc when you're drawing. If it doesn't work, just experiment with incrementing/decrementing and all possible stencil functions. One of them should work.

Jeroen

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this