Is there a tutorial or demo out which demostrates the following idea?
Use a combination of vertex programs and pixel shaders which use the TexKill function so that when you render a shadow volume, all parts of that volume that fall out of that the lights range are not rendered. This should save fill rate.
Already, lots of problems seem to emerge, I remember a lot of talk about capping shadow volumes, and while texkill could be used to create a nice spherically clipped shadow volume (something like in the CullFragment Complex NV Browser effect), this volume would be a nightmare to cap properly.
Someone had a version of the Quake engine which had shadow volumes implemented, and they used the scissor function to limit the area that the shadow volume could render to. I do not see any problems for that method because its basically like rendering to a smaller screen. But clipping to an exact sphere would probably cause problems.
I just wanted to through this out there, maybe there is a clever solution to capping the polygons, but I never seem to have enough time to actually program in OpenGL like I want to.
I am kinda suprised no one replied to this, since I thought it was such a good idea. I assume it must be cause I am completely out in left field on this idea, and no one is replying because completely wrong (but, then again, in most forums people ussually can’t wait to pounce on a wrong idea).
The basic idea is to use Cull Fragment (aka TexKill) to limit shadow volumes to the sphere that defines that area of the light. My only concern was that these volumes would not be capped properly.
I’ll try to implement it and report the results later.
Sounds ok. You could also use the alpha test. If you mask out colour buffer writes, do you still get the alpha test functionality? In the same way, do you still get the texkill?
I thought about alpha test, but figured that it would not be as precise because its only 8 bits while the Cull Fragment has the same precision is texture coordinates (32-bits?).
From what I gather, it uses the texture coordinate to cancel the rendering of a pixel much like an alpha test.
Buffer masks are orthogonal to the fragment tests, it would still need to determine if it needs to write Z or Stencil even if you have the color buffers masked out, and part of that determination is the alpha value of the fragment after it emerges from the texture environment (or combiners, or whatever). All this happens before it gets to the color mask stage.
I am beginning to have doubts about if this would have any advantages over any other methods one may use to save fillrate on shadow volumes. I’ll simply have to implement something and see what happens.