How to derive 4x4 shadow matrix

Started by
-1 comments, last by skytiger 14 years, 6 months ago
the directx docs state:
P = normalize(Plane);
L = Light;
d = dot(P, L)

P.a * L.x + d  P.a * L.y      P.a * L.z      P.a * L.w  
P.b * L.x      P.b * L.y + d  P.b * L.z      P.b * L.w  
P.c * L.x      P.c * L.y      P.c * L.z + d  P.c * L.w  
P.d * L.x      P.d * L.y      P.d * L.z      P.d * L.w + d
I have tried to derive the matrix myself and the closest I got was this:
{
 {ld - lpx * pna - pnd,   -lpy * pna,             -lpz * pna,             -pna}
,{-lpx * pnb,             ld - lpy * pnb - pnd,   -lpz * pnb,             -pnb}
,{-lpx * pnc,             -lpy * pnc,             ld - lpz * pnc - pnd,   -pnc}
,{lpx * pnd,              lpy * pnd,              lpz * pnd,              ld}
}
from this equation:
ld = lp . pn

      (vp - lp) * ld
vp' = -------------- + lp
      ld - (vp . pn)
I derived the reflection matrix in about 2 minutes - I have been working on this shadow matrix for 4 days now :-( in my test program my matrix works, the dx matrix does not does anybody know how to derive this matrix - are the directx docs correct? I keep expecting to have a forehead-slapping moment but its not coming ...

This topic is closed to new replies.

Advertisement