Advertisement Jump to content
Sign in to follow this  

OpenGL GLSL shader "light going through objects"

This topic is 2472 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

I, before asking any questions, i would like to thank everyone posting on this forum. It has really helpful since I started my OpenGL project.

I have a problem with my glsl shader. In fact I just don't know how to prevent any of it to happend. As you can see on the picture, the light from the red spotlight is "going through" the table.

How can i test is the path between the pixel being drawn and the light source is "free".

Thank you

Share this post

Link to post
Share on other sites
Short answer - you need to implement a shadow technique.

The two main categories of techniques are shadow mapping and shadow volumes (AKA stencil shadows). Shadow mapping is the more popular one these days, and there are literally hundreds of variations upon the basic technique, which involves rendering a depth-buffer from the light's point-of-view, and using this depth-texture in your lighting shader to determine if a pixel is in light or shadow.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!