Sign in to follow this  
QQemka

OpenGL Shadow problem

Recommended Posts

Hello. I've got problem shadow mapping. For some reason, the buildings are not casting shadows properly. The red, blue, green lines are positive XYZ axes respectively. White line is direction of the directional light (it's end is at xyz 60,30,60 which is used to construct the view matrix).

This is the effect I am getting http://i.imgur.com/mDZqfCy.png

This is, where i think the shadows should also appear (red circles) http://i.imgur.com/7n7Hb8G.png

That is my scene when instead of using camera view/projection i use light view/projection http://i.imgur.com/2eRSodj.png

Shaders are from this tut:

https://learnopengl.com/code_viewer.php?code=advanced-lighting/shadow_mapping&type=vertex

https://learnopengl.com/code_viewer.php?code=advanced-lighting/shadow_mapping&type=fragment

Why are shadows not complete near the house edges?

On the other hand, when I use projection matrix instead of ortho for the light, i am getting no shadows at all (but rendering the scene from light's point of view gives me nice view of the city)

Edited by QQemka

Share this post


Link to post
Share on other sites

My best guess is the bias value in the fragment shader is too large.

Try changing the bias value to 0, to see if that helps. You might get shadow acne instead, but it's just to figure out where the problem comes from.

 

Henning

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this