i have a little problems with shadow volumes. I have drawn my shadow volumes and the shadow is ok, but my object who throws the shadow is in the shadow too. I think i have to close the shadow volume.
I have drawn the object with incrementing the stencil buffer after i have drawn the shadow volumes, but it has no effect.
Later i have test to render the scene with lighting (shadow volumes without closing) and the stencilfunc
glStencilFunc(GL_EQUAL, 1, 0xff);
and my object is in the light. But normally the stencil value of my object should have a value like -1 or 255 or something like that.
perhas someone can help me, thanks.
I guess you should draw the beginning and ending caps of the volume (to close it). So, if you want that the obj not to be in the shadow you close the volume with the faces that are oppossite to light.
Just a suggestiong but gamasutra has an excellent article on shadowing (probably still on the front page…).
Yes, that’s an excellent paper. I implemented the algorithm presented in the scissor section. We’ve had discussion about just that - using a sphere to calculate the scissor rectangle. The section does contain a few errors ( typos in the formulas ). I ended up doing all the calculations which I would recommend for others who plan on implementing it ( it helps to understand it ).
Anyway, Cass and Kilgards paper also contains everything you need to get started.