Skip to main content
GameDev.net gamedev.net
🔒 Locked

Cubic Shadow Mapping

Started by DJTN Mar 28, 2011 at 12:12 AM 0 replies 1k views
Original Post
DJTN
DJTN
When creating the cubic shadow map's depth, what do I use as the world matrix and the world view projection matrix? Are these built off the light's position in world space or object space?


float4 positionWS = mul( input.Position, [color="#ff0000"]World? );
Output.Position = mul( input.Position, [color="#ff0000"]WorldViewProjection? );
Output.Depth = [color="#ff0000"]LightPosition? - positionWS;



Currently I've tracked my problem down to getting the same values for my depth and difference in the shader that renders the shadows. This means that I'm passing the wrong matricies to my depth shader.
DJTN
DJTN

When creating the cubic shadow map's depth, what do I use as the world matrix and the world view projection matrix? Are these built off the light's position in world space or object space?


float4 positionWS = mul( input.Position, [color="#ff0000"]World? );
Output.Position = mul( input.Position, [color="#ff0000"]WorldViewProjection? );
Output.Depth = [color="#ff0000"]LightPosition? - positionWS;



Currently I've tracked my problem down to getting the same values for my depth and difference in the shader that renders the shadows. This means that I'm passing the wrong matricies to my depth shader.



I've figured this out on my own. What was throwing me off was acne and jagged edges. It made me second guess the view, projection, and world matrix that I was passing in.

For anyone else questioning this; In the PS code above. The World and the WorldViewProjection matricies (matrixes) are the ones you create when writting to the depth texture from the point light's point of view. The light position is the lights position in world space.

The code TiagoCosta posted on my other post LINK. Is what I started out with but is just the basic building blocks. The code has to be added to and massaged into something that will work for your engine/hardware requirments etc.. Hope this helps...

regards,
Dj

Topic Locked

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

Sign in to reply to this topic.