Computation of Shadow Polygon onto an
Axis-Aligned Plane
Kenny Hoff
2/27/96
Given a polygon as an array of points Pts[NumPts], an x, y, or z value of the axis-aligned plane depending on whether the plane is parallel to the YZ, XZ, or XY plane respectively, and finally a single point light source L (Lx, Ly, Lz).
We can compute the projection of this polygon onto the desired plane as an array of points ProjPts[NumPts]. The projected polygon will be in world coordinates and should have the world, perspective, and viewing transformations applied to it before viewing.
Our first example will be on a plane parallel to the XY plane, so a Z-value must be given (Zp). Now for each point P in the polygon, we will calculate a projected point P'. This projection is exactly like a perspective projection with an arbitrary center-of-projection, except that the COP is the light source (L) and the object to be projected is supposedly between the light and the projection plane.
Now we form a ray equation from the light source through the point P:
P(t) = L + (P-L)t
To find P', we need only solve the ray equation using the parametric t of the ray P(t) when it intersects the projection plane.
When P(t)Z = Zp, the ray P(t) intersects the plane; so we can solve for t:
P(t)Z = Zp = LZ + (PZ-LZ)t
ZP-LZ = (PZ-LZ)t
(ZP-LZ) / (PZ-LZ) = t
Now substitute t back into the ray equation to obtain P':
P(t) = P' = L + (P-L) * [ZP-LZ)/(PZ-LZ)]