Hi Joe,
my current direction light has more the behavior of a point light in Shadow drawing, as a direction light. In the SimpleShader i calculate the shadows with the view and projection matrix of a light, that i create a the CPU on a Update Fuction in my Light Class
// Space is a Class where I store Transformation Informations of the World Space Matrix and Side/Up/Look Vectors etc. of the Light
// Translate is the Postion of the Light
public void Update(float renderTargetWidth, float renderTargetHeight)
{
this.direction = this.space.LocalLook;
this.view = Matrix.LookAtLH(this.space.Translate, this.space.Translate + this.space.LocalLook, this.space.LocalUp);
this.projection = Matrix.PerspectiveFovLH(Math.DegreesToRadians(45.0f),
renderTargetWidth / renderTargetHeight, 0.1f, 1000.0f);
}
But i am a totally noob in Light and Shadow Stuff. So i need to start from the beginning.
In Graphics and Game Engine like Maya, Unity etc. if i create a direction light, all geometries will lighting from the direction of the light. I do this with:
float3 lightFront = LightColor * saturate(dot(Nn, -Ln)); (Ln = Light Direction of my DirectionLight).
But how works it with the shadows, there are must be a fix positon, where the light source looks of all geometries from far, far away, always in the right angle, i imagine?
Can someone explain me it, how a direction light calculate all the shadows in the whole scene with a view and projection matrix?
Greets
Benjamin