Jump to content

  • Log In with Google      Sign In   
  • Create Account


GLSL shader "light going through objects"


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 overflowsc   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 April 2012 - 02:31 AM

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.
example.jpg

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

Thank you

Sponsor:

#2 Hodgman   Moderators   -  Reputation: 27506

Like
0Likes
Like

Posted 15 April 2012 - 02:46 AM

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.

#3 overflowsc   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 April 2012 - 02:54 AM

Thank you Hodgman, I'll try this out.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS