PDA

View Full Version : Planar Shadows (somewhat OT)

kabir
09-06-2001, 01:40 PM
Hiya,

I've been cruising along learning OpenGL out of the SuperBible, and I just got to the bit about planar shadows. The methodology presented (use a shadow matrix to multiply the projection matrix and "squish" the object into a plane) makes sense to me, but I'm annoyed that there is no explanation of the derevation of that shadow matrix.

Now, I know that there are problems with this methodology, and that there's some other stuff I need to be doing to generate good planar shadows (stencil tests, etc.) but I'm not concerned with any of that right now. Now I'm just trying to hunt down some clues to the derivation of that bloody matrix. I've sat down and gone through the derivations for planar geometric projections with the DOP coincident with (or at least parallel to) the z axis, as well as those where the DOP is not conincident to the z axis but the projection plane is perpendicular to the z axis, but I can't seem find any reference about making the projection onto an arbitrary plane, nor do I seem able to make the leap to the derivation myself (though I haven't quit trying!). Mostly I've been working out of Computer Graphics: Principles and Practice ( http://www.amazon.com/exec/obidos/ASIN/0201848406/ ) so far, but as the projections discussed there are intended for the primary viewing projection they solve the problem via normalizing transformations, which is grand but doesn't help me generate a shadow matrix (though I'm investigating the possibility of incorporating a normalizing transfomation into my shadow matrix - I haven't yet worked out if that's feasable or will produce the correct effect yet).

If anyone could point me to a resource for finding that derivation I would appreciate it very much - I don't like simply accepting the matrix I've been handed without understanding where it came from.

Thanks

zed
09-06-2001, 07:18 PM
check the red book theres an explanation of the maths behind it in there

kabir
09-06-2001, 07:41 PM
Originally posted by zed:
check the red book theres an explanation of the maths behind it in there

I never even thought to look there... It's exactly what I needed, thanks!

As I suspected I was overcomplicating matters rather a lot. CG:P&P uses the similar triangles method to derive their projection formulas, and I was trying to extend that to arbitrary planes, rather than simply using line/plane intersections... d'Oh!

thanks very much Zed!!