PDA

View Full Version : Shadow Volumes problem with GL_EXT_stencil_two_side



unreal
12-16-2004, 03:30 AM
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! :p ) 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

James Dolan
12-16-2004, 05:31 PM
You probably still have backface culling on or something.

Twixn
12-16-2004, 07:18 PM
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

unreal
12-16-2004, 11:16 PM
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". ;)

Twixn
12-18-2004, 12:09 AM
Are you using a Vertex shader/program to extrude the shadow object on the hardware?

Twixn

unreal
12-18-2004, 12:23 AM
No I don't. :(
But I will if I can and when i finish everything else in the engine. ;)

Twixn
12-18-2004, 01:21 AM
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

James Dolan
12-18-2004, 08:58 AM
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);