Sign in to follow this  
YellowMaple

Spotlight cutoff question

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this