Shadow Volumes problem with GL_EXT_stencil_two_side

well… I was trying to make two_side_stencil EXT work…

Until now I was doing this for rendering shadow volumes:

http://rafb.net/paste/results/IKd7B616.html

and is was working perfectly.

now i try to do this:

http://rafb.net/paste/results/PBFUPf60.html

but I can’t see the shadow! the shadow does not appear!

My card(well its not mine. I must give it back in 3 days! :stuck_out_tongue: ) is an nVIdia 6800. It supports GL_EXT_stencil_two_side and GL_EXT_stencil_wrap extensions.
I also have setup the extension correctly.

what i do wrong?

thanks in advance

You probably still have backface culling on or something.

Try swapping:

glActiveStencilFaceEXT(GL_FRONT);
glStencilOp(GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);

and

glActiveStencilFaceEXT(GL_BACK);
glStencilOp(GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);

so that GL_FRONT is the active face when rendering volumes, that solved a problem i had that resembled yours.

Twixn

guys thank you!
thats it!
I must have the GL_FRONT to be active when render the shadow volumes. thank you.

I have a little speed boost now. for the shadow volumes for 20 spheres, I had 33fps and now I get 38fps. Pretty good “optimization”. :wink:

Are you using a Vertex shader/program to extrude the shadow object on the hardware?

Twixn

No I don’t. :frowning:
But I will if I can and when i finish everything else in the engine. :wink:

Well, its another way to squeese more fps out of two sided stencil, and its something to consider. Post a Question here anyway when u feel like it, someone will point u in the direction of some tuts.

Twixn

Just FYI, the ATI_separate_stencil (no ATI cards as far as I know support EXT_stencil_two_side) path for the same thing is…

glStencilFuncSeparateATI(GL_ALWAYS, GL_ALWAYS, 0, ~0);
glStencilOpSeparateATI(GL_BACK, GL_KEEP, GL_INCR_WRAP_EXT, GL_KEEP);
glStencilOpSeparateATI(GL_FRONT, GL_KEEP, GL_DECR_WRAP_EXT, GL_KEEP);