Thursday, May 2, 2013

Graphics Assignment 12

So much satisfaction after seeing the shadows work properly. I did face some problem but luckily they were small mistake which JP helped me figure out.

For doing shadows, I created a texture and a surface. This was used to create a shadow map. A shadow map is basically depth map with respect to the light. This shadow map is used to figure out which point on the map is closer to the light.

For doing shadows, we pass the view position and projected position of the pixel in light's space. Then the z value of the view position in light space is compared with the value which is looked up in the shadow up. The projected position of the pixel in the light space is used as texture co-ordinates for looking up the value in the shadow map.

Here are the screenshots of my Renderer and Shadow Map.



Here's the link to my code: Download Code

No comments:

Post a Comment