Robust stencil shadow volumes


I’m working with the robust stencil shadows volumes, as presented in the 2002 siggraph article, and Eric Lengyel column from gamasutra, but there seems to be some things i have a hard time understanding, with regards to the projection matrix with backclipping plane at infinity.

First of, they do a homogenous vector difference - What is this?
I would say it should be X_1/W_1 - X_2/W_2, but somehow, they rearrange it to be X_1W_2-X_2W_1.

I can clearly see that it just works™, and that my arithmethic will fail for lights/points at infinity. What is the explanation, how is it rewritten? How do I intuitively understand it?

The second thing is with regards to the matrix. Given the vector difference, I see no reason why we should not end up with a point projected to infinity, looking like this

[ x y 0 0 ]

in case the light and the vertex have the same z value. This leaves me wondering what will happend in the clip stage.

Clearly the only value that will satisfy
-w <= (x,y,z) <= w, is zero. The z value is fine, but what happends to x and y? Will the clipping clip them to zero?

Can this really be what is happening?

Any hints appreciated, I’m going to refresh those line clipping algorithms to try and understand what happends.

Regarding the second question, I think I have an clearer understanding now.

The thing is, that it is the line segment with one of the vertices with a zero W value. When this is clipped against the planes x=w, x=-w etc., in homogenous coordinates, it will get a valid(nonzero) value that we can divide with.

My first question is still unclear to me

Hi jonasmr,

On your first question, multiplying all components of a homogeneous point by a constant doesn’t change the projected real point, so

w1w2( x1/w1 - x2/w2) = (x1w2 - x2w1).

And this way, we don’t have to worry about divide-by-zero.

Make sense?

Thanks -

edit: I should proofread before I submit.

[This message has been edited by cass (edited 01-23-2004).]

Cass -

Yes, that is quite clear now.

Pretty simple, and very neat.

Thank you,