Hi,
Recently, I am reading Frank Luna's introduction to game programming with directx 11. Frankly, I am a dx noob. When reading how to implement the planar shadow using the shadow matrix(in chapter 10), I cannot go on any more :(. I cannot understand when the perspective divide occur when multiply a point by the 4x4 shadow matrix.
The following 4x4 matrix is the directional shadow matrix,
The author said:
To use the shadow matrix, we combine it with our world matrix. However, after the world transform, the geometry has not really been projected on to the shadow plane yet because the perspective divide has not occurred yet.
if [p_x p_y p_z 1] is the point in the world space, we get s = [s_x s_y s_z n\cdot L] when multiplying it with the directional shadow matrix. This is not the projected point to the shadow plane (the shadow plane's equation in dx11 is denoted by (n, d)), but if all the components of s are divided by n\cdot L, we will get the correct projected point in the world space. The Mathematics is easy to understand, but I cannot understand the way using the shadow matrix in dx11 application.
?The code snippet in the book's demo is as follows:
?
?
In the code, I cannot find when the divide occur. I need your help, thanks very much!