For more information, see http://thecode.cafe/posts/lighting-2d.
Learn to use this lighting system with Shaun Spalding: https://www.youtube.com/watch?v=RFRV3lhVOhg
This is a real-time and lightweight shader lighting system for dynamic pixel lights that composites multiple lights into a single surface. The surface is fitted to a "camera" that is used to perform the lighting pass.
Instances that inherit from the object
obj_shadow_caster are able to cast shadows, and lights are placed and configured in the game with instances of
obj_light. It has good support for object variables.
It is my desire to provide a general lighting system that could be further customized to suit the needs of each specific game project it is used in. To get the best performance, or lighting quality, or whatever else, for your game you will probably end up modifying it to some extent. It might also work well for your game or prototype out-of-the-box by tweaking some of the knobs.
You can easily upgrade the lighting system, once integrated in your game, to a newer version by simply replacing the previous version's assets in your project. It also tracks various statistics (if you opt in) that help you optimize your use of the system.
The repository is hosted on GitHub and is available here: https://github.com/borup3/Lighting-System-2D.
The demo project repository is also hosted on GitHub and is available here: https://github.com/borup3/Lighting-System-2D-Demos.
Lights are defined as a set of attributes that determine their behavior, so they are decoupled from the object that created them. These attributes include spatial information, rendering attributes like color, range and intensity and what type of light to use.
The following light types are supported at the time of writing:
PointOmnidirectional point emitter
SpotConical point emitter
AreaUnidirectional line emitter
LineBidirectional line emitter
DirectionalInfinite directional light without an emitter source
These light types give you a lot of possibilities for lighting up your game worlds.
End User Licence Agreement (EULA).