I want to make a spotlight but I don’t know what type of math function I should use to represent them. For the falloff and radius of impact I’m using an exponential function and it works great, the problem is the actual light of a spotlight. I want to have two more settings besides the radius; I want an internal cone and an external cone to define de falloff of the projected spotlight. In the internal cone the light is pretty strong, and from the internal cone to the external cone the light should falloff to complete darkness.

         / @@ \
        / @  @ \
       /  @  @  \
      /  @    @  \
     /  @      @  \
    /  @        @  \
   /   @        @   \
  /    @        @    \
 /    @          @    \
/     @          @     \

So in my ugly ASCII drawing here, the @ show the boundaries of the inner cone, inside that era the light is pretty strong, and from that to the slashes the light starts to falloff and when it reaches the actual slash then the value the brightness value is 0.
I hope any of you can help me, thanks.…tlightmodel.asp

glspec20.pdf from this very site has the equation for a spot light. It’s on page 60-62.

Basically, the spotlight looks at the normalized vector to the lit primitive (vertex or fragment) from the light source, and dots this with the light direction. Then it performs scaling, offset and clamping, such that the result is 1 when the dot is >= the spot width factor, and the falloff is whatever you’ve configured it to.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.