I have implemented shadows in to my game engine. They look fine when rendered in projection mode as a projected light, however I get a strange "blocky" look when they are put into orho'. I will be rendering much bigger scenes (MMO size maps, for example) and Ive heard that rendering in orthographic for the shadow map will give a better result, and it does in some ways. I dislike rendering with projective perspective as you can see the view frustum, whereas this doesnt happen with orthographic.
Here is the code I have for rendering every update:
public void UpdateLightData()
{
Matrix lightsView;
Matrix lightsProjection;
ambientPower = 0.2f;
lightPower = 2f;
cameraFrustum.Matrix = player.view * player.projection;
lightPos = new Vector3(0, 30, 0);
lightsView = Matrix.CreateLookAt(lightPos, new Vector3(-2, 3, -10), new Vector3(0, 1, 0));
lightsProjection = Matrix.CreateOrthographic(Globals.device.Viewport.Width, Globals.device.Viewport.Height, 0.1f, 100f);
//lightsProjection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, 1f, 5f, 100f);
lightsViewProjectionMatrix = lightsView * lightsProjection;
}
Here is a screenshot of ProjectionPerspective: https://www.dropbox.com/s/yen671frsft4kdl/Screenshot%202015-03-07%2016.00.32.png?dl=0
Here is what it looks like in orthographic: https://www.dropbox.com/s/jj6h4zgodda38fe/Screenshot%202015-03-07%2016.01.19.png?dl=0
SampleCmp
). \$\endgroup\$