Skip to main content
gamedev.net
🔒 Locked

Shadow Maps

Started by SeiryuEnder Apr 5, 2009 at 2:09 PM 1 replies 700+ views
Original Post
SeiryuEnder
SeiryuEnder
I've been working on shadow mapping, reading books and articles across the internet. Before I start coding on it, I want to have a solid understanding of everything I'm going to do. From what I understand, I need to create a matrix that maps 3D space onto a 2D plane, representing the depth components for everything the light has contact with in the world. This is the most sense I can make out of it right now. I know that I need to translate out to the position of the light, but I'm not sure how to set up the frustum for rendering since a point light is omnidirectional. The math behind it is a little scary. I've been looking at some sample code by Fabien Sanglard and various other sources around the internet, I just don't want to attempt to utilize code I don't understand... Thanks for any and all help!
Black Knight
Black Knight
If you want a point light then you will probably need to render shadow casters to a cube map.So that you have all the shadows in all six directions.As for spotlights you can use a perspective or orthogonal projection.After you set your viewing and projection transformation you just render all shadow casters' depth values to a render target and use those values to see if objects in the scene are shadowed or not.
dpadam450
dpadam450
Quote:
From what I understand, I need to create a matrix that maps 3D space onto a 2D plane, representing the depth components for everything the light has contact with in the world.


Shadow maps took me a while to visualize. Your above quote though is already done for you. When you normally draw in GL, you set depth testing on correct? So all the 3d stuff you draw is mapped to the 2d screen, and the depth values from your point of view are set.

Now say you take a lamp in your house. Wrap something around it tight, the depth buffer would hold values close to 0. So any point in your house, has a distance from your lamp that is way farther than 0. So they would be unlit.
NBA2K, Madden, Maneater, Killing Floor, Sims 

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.