Jump to content
  • Advertisement
Sign in to follow this  
Xpoint

GLSL point and spot light question

This topic is 4887 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'm creating a engine, and it supports per-pixel lighting, specular reflections and parallax bump mapping now. (all in GLSL) The directional light is working fine, the point light also works fine, but how can I let the point light fade out if it moves away?? And how do I create a spot light? I'd like a spotlight with two angles (inner angle and outer angle, for fade effect). Thanks in advanced.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Xpoint
Hello,
I'm creating a engine, and it supports per-pixel lighting, specular reflections and parallax bump mapping now. (all in GLSL) The directional light is working fine, the point light also works fine, but how can I let the point light fade out if it moves away?? And how do I create a spot light? I'd like a spotlight with two angles (inner angle and outer angle, for fade effect).

Thanks in advanced.
It sounds like what you want is attenuation, right? Check out the lighting chapter in the Red Book and look at the Mathematics of Lighting section. The attenuation factor is in there. It also has the math for OpenGL spotlights. While they only use one angle, it should give you some ideas. I know I've seen a spotlight implementation with an inner and outer angle somewhere online, I can't remember where though. [sad] Try searching on google if you haven't already.

Share this post


Link to post
Share on other sites
I'd make sure to check out the Lighthouse3D GLSL tutorials if you haven't already at www.lighthouse3d.com/. They have stuff on point lights and directional lights with attenuation.
~Mark

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!