[dx9 HLSL] Shadow Map with point light

Started by
3 comments, last by zipwax 12 years, 1 month ago
Hi all,

i am reading the tutorial for implementing shadow map in HLSL directx9 at
http://www.gamedev.net/page/resources/_/reference/programming/special-effects/shadows/soft-edged-shadows-r2193

and got me wondering how shadow map is done when using point light?
see, the tutorial is using a directional light where the LightViewProjection Matrix is calculated using D3DXMatrixLookAtLH( &matView, &vLightPos, &vLightAim, &g_vUp );
Point light does not have direction, but the direction is computed in HLSL instead.

so how do i do the shadowmap descrbed on the above link using point lights?
How do i compute the lightViewProjection matrix for point lights? can it be done in HLSL?

Thanks,
Advertisement
You can represent the point light as 6 spot-lights (cubic shadow maps), or 2 spot-lights (dual paraboloid shadow maps), or if the light source itself is outside the view-frustum, you can take a short-cut and treat it as a single spot-light.
That wasn't the most informative reply. Why represent it as six spot lights? Why can't I find a HLSL example for a point-light shadow routine where the point light simply uses a perspective transformation instead of a orthographic transformation? Are there any examples online of a point-source shadow mapping (SIMPLE) example?
take a look at http://gamedevelop.e...dow-mapping.htm
To the first guy who asked the question, I figured it out. For a point-light, you simply duplicate the exact same projection matrix as you use for the camera. In other words, move the "eye" to the point source's location (the view matrix), and calculate the projection matrix to be the same as you used for the camera. Then calculate the shadow map. Be careful that the light is not too close to your model, or the shadow map won't contain all of the model, and you'll get STRANGE shadows.

This topic is closed to new replies.

Advertisement