Jump to content
  • Advertisement
Sign in to follow this  
YellowMaple

Spotlight cutoff question

This topic is 3123 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'm using the following equation to compute attenuation for my spotlight so that it will: spotDot = dot(-vLight, spotDirection); spotAttenuation = pow(spotDot, spotExponent); where vLight is the vector from the surface to the light and spotDirection is the direction the spotlight is pointing. If a point is outside the cutoff, I set the attenuation to 0. This is then multiplied with the diffuse of the surface to get the final colour. Everything looks good, but there's still a sharp change in the colour around the area of the spotlight cutoff unless I use higher exponent values. Am I doing something wrong? Or am I supposed to be taking a parameter for the inner cone and outer cone to allow a spotlight to transition smoothly between lit areas and the shadow areas outside the cutoff?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by YellowMaple
Or am I supposed to be taking a parameter for the inner cone and outer cone to allow a spotlight to transition smoothly between lit areas and the shadow areas outside the cutoff?


That's how I like to do it. You can use smoothstep to make the transition nice and smooth.

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!