PDA

View Full Version : Capped Shadow Volume



powerpad
05-23-2005, 10:26 AM
When I want to draw a capped shadow volume
I proceed as outlined by lengyel in his article

for a silhouette edge I do..

1. take all vertices from a triangle that faces towards the light

2. extrude all vertices from a triangle that faces away from the light to infinity with respect to the light direction

Until now I add those vertices into my List of vertices making up the silhouette ...
but It is said that the shadow volume should be closed should I therefore insert the vertices in such a way that I get some polygon formed by the front cap, back cap and sideplanes closing the front and back cap

or is it totally sufficient to inseert the vertices to have a triangle that represents the front cap and the vertices to have a back cap.

tnx for your help

powerpad
05-24-2005, 11:53 PM
looks like nobody is willing to answer my question but I hope this one will be answered (tnx in advance)

When extruding the vertices V of a shadow quad for a silhouette edge to infinity the formula

(1)

V'= <V.x - L.x, V.y - L.y, V.z - L.z, 0>is used. Is this correct? I drew those quads for a simple cube but my idea would be to use
(2)

V' = <V.x + (V.x - L.x), V.y + (V.y - L.y), V.z + (V.z - L.z), 0>instead. Since in (1) I get shadow quads starting at the origin and pointing to some V'
but according to my understanding I want a Shadow Quad V'
starting at the V and pointing to V'

please help me

SeskaPeel
05-25-2005, 02:24 AM
http://www.gamasutra.com/features/20021011/lengyel_01.htm

SeskaPeel.

powerpad
05-25-2005, 03:02 AM
I know this paper ... this is where (1) is from (so it must be correct) but it is against my oppinion ... but if everyone uses that ... tnx

cass
05-25-2005, 05:19 AM
Extruded silhouette polys should go from their original location V to their projected location V'. How you compute V' depends on whether V and L are expressed in general homogeneous coordinates (V.w != 1). You need a more general expression if they are.

Otherwise it looks like you're on the right track.

You might also take a look at:
http://developer.nvidia.com/object/robust_shadow_volumes.html

Thanks -
Cass

powerpad
05-25-2005, 05:49 AM
I read lengyel's article on shadow volumes and he
extruded the vertices like this

V' = V.w*L + <V.x-L.x, V.y-L.y, V.z-L.z, 0>

V is processed prior to have w=0 for Vertices to be extruded and w = 1 for vertices extruded not to be extruded

this results in the Code I displayed in (1) for vertices to be extruded

Christian Schüler
05-26-2005, 04:16 PM
Because you're projecting to infinity, all that matters is the direction V - L. Any offset is immaterial when going to infinity.

Here is another little bit that may help ...

http://www.flipcode.com/articles/article_shadowvextrude.shtml

powerpad
05-26-2005, 08:53 PM
Thanks for your answer. I saw it working in my small little app and it looks alright.