I wasnt sure what forum to put this in...it's related to shaders so.. Ok, suppose i want to render multiple stencil shadows, and use this stencil buffer in a lighting shader. Is there some way to use the same stencil buffer to hold all the data for several shadow pases (say 4)..? I cant really figure out how the stencil buffer really works..(i have all this working by using multiple stencil buffer surfaces) I cant find any good documentaion on what the renderstates like STENCILMASK and STENCILWRITEMASK really do, or what the available values are.. and how do they relate to STENCILREF? I'm sure anyone who knows something about this will understand what i'm asking..
Yes i have looked at the refernces, but i still dont see any real explanation of how it works.. only very basic stuff. I have tried writing with a differnert mask, and various stencil refs.. nothing works.. is there any way to to render multiple shadows with one depthstencil buffer? I suppose i could try clearing the stencil buffer for every pass, render the shadows, then render a light pass.. but this seems awkward.
Yeah, that does seem a little odd, and would be better if you could just do it once. I'll take a peek at it sometime this weekend and let you know if I find anything...
Ok .. well i have gotten it work by just rendering each pass seperately, rendering the shadows in-between.. this seem to be fast..This way you only need to use one depth buffer, and only render the scene to z-buffer once.. then you can turn off zwriting from then on. I guess this is the way it's done..