Mintmaster
Veteran
Hi 3D experts, I've got a puzzle I can't figure out, and don't know if it's possible.
I want to set the stencil buffer renderstates so that I draw a fullscreen quad, and every non-zero stencil value now get set to 0x02.
Basically, I've stenciled out an area using shadow volumes, and so there are now areas with values greater than one depending on how many shadows overlap. I want to now set all areas with at least one shadow to the same value.
It seems like such a simple task, but I can't see the solution since there's only one reference value. Can anyone else figure it out?
EDIT: Well, in my particular case I found a solution, but it sort of sucks. I can set the reference to 0x01, use function LESS & stencilop REPLACE, then do a second pass with function EQUAL & stencilop INCR. There has got to be a better way though, especially if I wanted a different value.
EDIT2: While on the topic of stencil buffers, does anyone know why there isn't a stencil-fail-z-pass case to hold a separate op? I've come across a few situations when it would be useful.
I want to set the stencil buffer renderstates so that I draw a fullscreen quad, and every non-zero stencil value now get set to 0x02.
Basically, I've stenciled out an area using shadow volumes, and so there are now areas with values greater than one depending on how many shadows overlap. I want to now set all areas with at least one shadow to the same value.
It seems like such a simple task, but I can't see the solution since there's only one reference value. Can anyone else figure it out?
EDIT: Well, in my particular case I found a solution, but it sort of sucks. I can set the reference to 0x01, use function LESS & stencilop REPLACE, then do a second pass with function EQUAL & stencilop INCR. There has got to be a better way though, especially if I wanted a different value.
EDIT2: While on the topic of stencil buffers, does anyone know why there isn't a stencil-fail-z-pass case to hold a separate op? I've come across a few situations when it would be useful.