HLSL Shadow Map |
This programs adds a shadow map to my last project. First, the torus is rendered from the light point of view into a texture. In the texture, the color memorize the depth between the fragment and the light position. Then the actual rendering of the scene is done. I just add the shadow on the floor. I use the method called projective texturing to project the shadow map on the floor. In the pixel shader, i use the depth memorized in the shadow map as a coefficient to know if i am in the shadow or not. This method is know as shadow mapping, and one can find many documentation about it on the web.
download : exe+sources (C++,HLSL and Visual C++ 6.0 project) (1385ko)
Require a graphic card with support of vertex shader 2_0 et pixel shader 2_0.
Author : Adrien Auclair
adrien.auclair at club-internet.fr
Last update : 06/10/2004