Jump to content
  • Advertisement
Sign in to follow this  
QQemka

OpenGL Shadow problem

This topic is 603 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!