Jump to content
  • Advertisement
Sign in to follow this  
skytiger

How to derive 4x4 shadow matrix

This topic is 3175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 ...

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!