Hi
I want to implement Shadow Mapping using orthogonal projection for directional lighting. The shadow map orthogonal frustum shall wrap around the Scene perspective frustum.
To calculate the projection transfrom for the shadow map I will use the D3DXMatrixOrthoOffCenterLH function. This function takes the vertices from view space (camera pointing in the lights direction) to projection space for the shadow map.
But in order to fill out the parameters correctly I need to get the Scene frustum vertices which are in Scene projection space, transform them back to world space, and forward into shadow map view space. Then I will max(), min() the x and y values, maybe I need w-division first?
How do I get the scene frustum vertices? Are they the simply the cube corners in clip space (-1, -1, 0) (1, -1, 0) (1,1,0) (-1, 1 ,0), (-1, -1, 1) (1, -1, 1) (1,1,1) (-1, 1 ,1) ? Do I have to perspective (divide)/multiply them with a w-value to get them to projection space from clip space? When I have them in perspective projection space I can use the inverse camera matrix to get them to world coordinates.
Cheers!