Basic Spot Light Implementation

Since my last post, I have been working hard with my team to get our game Project Neon, now titled Valo: Frozen Light ready for release. It has come along really well and looks and plays incredibly. But I digress on to the topic at hand.

Spot Lights

Spot lights are only a bit more complex than point lights. Spot lights are essentially point lights that have been restricted to a direction and an angle in relation to that direction. The additional variables that belong to spot lights are a vector for the direction, and an angle for both the inner cutoff and the outer cutoff of the lights.

The inner and outer cutoff give the spot lights an extra factor of realism. The edges of lights don't just stop abruptly, they fade off over an often small distance. The angle given as the inner cutoff is the beginning of this fade, and the outer cutoff is the end of the fade, or where the only light left is the ambient light. It should also be noted that these angles are in relation to the direction vector, so without any modification to simplify the system for designers a spot light that looks to have a complete angle of 90 degrees, will have had cutoffs of 45 degrees. A spot light with inner and outer cutoffs of 180 degrees is essentially a point light.

It was here that I discovered a slight flaw with my point light implementation, brought to my attention by the fact that the direction and angle of the spot lights would change based on the lights position in the world, and not a change in the direction vector or the angular cutoffs. Previously I had been applying the INSERT matrix to the position, direction, and cutoffs of the lights.






I am still working on getting basic 2D shadows into Valo using a Shader Storage Buffer Object. and will post an update when I get that working correctly.

Timothey Goodwin
RTIS Student
General Programmer (Currently Specializing in Graphics)
DigiPen

Comments