PDA

View Full Version : How to create degenerated quads in vertex shader shadow volume?



Xorand
08-29-2003, 10:15 PM
I want to use vertex shader in shadow volume. And I read the tutorial about it in this (http://www.gamedev.net/columns/hardcore/shadowvolume/page5.asp) . But I am a little confused about how to create degenerated quads. "The sides of the shadow volume are formed auto-magically by the degenerated quads residing along the silhouette edges." What it means? What algorithm I should use to create degenerated quads in this? Could any one teach me? Thank you.

dorbie
08-30-2003, 01:18 AM
You have two tris T1 and T2:




v1 v2
______
/| /
/ | /
/ |T2 /
/T1 | /
/ | /
/_____|/
v3 v4

The degenerate quad is the quad of zero area formed by 4 vertices v1 v1 v4 v4. The reason this forms the extruded volume is that the normal on each vertex is different, one pair of vertices, v1 and v4 have the normal of T1, the other pair have the normal of T2. The vertex program projects the vertex depending on the dot product of the normal and the vector to light. This means that for a silhouette edge where T1 and T2 have different signs on the dot product result the degenerate quad will be projected to a non degenerate quad as the side of the extruded volume.

[This message has been edited by dorbie (edited 08-30-2003).]

Xorand
09-02-2003, 06:28 PM
Thanks for your exposition. I think I understand what it is now.

[This message has been edited by Xorand (edited 09-06-2003).]