Not satisfied with stencil shadows

BlitzMax Forums/BlitzMax OpenGL Programming/Not satisfied with stencil shadows

The Forum Archive is locked. These are the original blitzbasic.com forums, kept so their posts can still be read and searched. No new topics, replies or edits can be made here. To join the conversation, head over to the Blitz3D+ forums.

If your stencil buffer is >1bit and you render some geometry from 2 lights whos shadows overlap, then the stencil buffer should be set to 2 where they overlap.

If you're doing the 'render a dark transparent quad over the entire screen' method, you can set the stencil buffer to D3DCMP_EQUAL/GL_EQUAL, set the stencil reference to 1 and render. This will only draw where each lights casts shadows discreetly.

If you then set the reference value to 2 and rendered the quad again (with either a multiply mode or make the quad less transparent) it would only draw where the shadows overlapped.

With me now?

The other method I've not tried yet, where you render the shadow volumes first, then render the scene with just ambient where the stencil is 0, then normal lighting where the stencil >=1.