Suggestion for shadow volumes improvement

I didn’t bother with shadow volume too much and this suggestion could be wrong.

As I read from various docs and papers and if I understand correctly, programmer should, for some 3d model, build copy of vertices and just modify some attribute in vertex copy. Also he should generate more faces - strips (Im, IXm - In, IXn; Im,In are indices of normal vertices; IXm, IXn are indices of vertices prepared for extrusion) for each edge aka. wedges. This small modification in vertex copy give information for vertex shader to know should extrude vertex or not.

My idea is to hw vendors make extension which can duplicate each glVertex call (or duplicate vertices in any vertex glDrawXXXX call) but only to set some even/odd flag in state. This even/odd value in gl state should be accesible from vertex shader.

How to use it?

App should detect silhouette and sent only this (silhouette) vertices. Extension should internally duplicate each vertex call, and update even/odd state. Vertex shader will be executed twice with different flag state. So even/odd state on beginning is 0. In first call, flag is 0 - vertex shader will transform vertex as usual. Now, state is changed to 1. In second call flag is 1 - vertex shader will transform and extrude passed vertex. Set flag back to 0.

I know that new HW have several vertex pipes so it could be difficult to manage state for each pipe. Maybe some wired read-obly even/odd vertex attribute can help.

Is it big problem to implement such extension?


i used to think something like this would be a good idea. but honestly i think it would be a bad idea to build shadow volumes directly into any opengl api. simply because i don’t think shadow volumes will last. the effect is really cheesy at the end of the day, no matter how many passes you do. mipmapped shadow maps i think would win out in the end if something better doesn’t pop up.

it would be useful for an instancing interface though. so that you could do a single drawing pass and render multiple objects with or without different shaders. you could draw 32 leaves at a time, or draw an object with one shader and its shadow with a seperate shader at the same time.

this is a hardware issue though and not necesarrily an opengl request anymore than hardware drives opengl. an opengl driver could emulate this, but it would probably be very inefficient because rendering states would be changing in an interleaved fashion which is probably not so effecient.

edit: you may want to look into “robust” shadow volumes. you don’t need to solve silhouette. this is more realistic in the end i figure for hardware stencil volumes.