Hi everyone,
i, am working on my master project and have a lot of trouble with shadows.
I created a little scene with the help of vulkan.
Make my three rendersteps
1st. Geometry Pass
2st. Shadow Pass
3st. Deferred Pass
I got the shadows, but they overlap with my mesh.
I don't know why. I assumed, the reason for this could be the perspective Matrix.
So, I changed this to orthographic, but then there is no visible shadow.
Does anyone have an Idea, does anyone had the same problem in the past and could solve it?
This is the code of my Light Space Matrix Calculation:
LightIndex GraphicsInstance::AddLight(Light& light)
{
mLightUbo.light[lightIndex] = light.GetLightInformations();
// Light Transformation Matrix Generation
float near_plane = 1.0f, far_plane = 64.0f;
//glm::mat4 lightProjection = glm::ortho(-10.0f, 10.0f, -10.0f, 10.0f, near_plane, far_plane);
//lightProjection[1][1] *= -1;
glm::mat4 lightProjection = glm::perspective(glm::radians(45.0f), 1.0f, 1.0f, 96.0f);
glm::mat4 lightView = glm::lookAt(glm::vec3(light.GetPosition()),
glm::vec3(0.0f, 0.0f, 0.0f),
glm::vec3(0.0f, 1.0f, 0.0f));
mLightUbo.lightSpaceMatrix = lightProjection * lightView;
}
Kind regards and thx
Pixma ?