Jump to content
  • Advertisement
Sign in to follow this  
Prune

Arrrgh! Shadow volume problem... help please

This topic is 3995 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!