A 2D lighting demo

Lighting for 2D games using shaders, normal maps, point lights, and color blending

Inno Spelman
Class:
Instructor:

A lighting system I built from scratch using shaders and surfaces in game maker studio 2.

Made for my Shader Lab final with my professor Chris Chung.  Here’s how it works!

 

First I establish the sprites that I want to use onto a surface that holds the color data

The next step is to establish another surface to hold the sprites’ normal data

Then for each individual light I calculate the lighting vector information as RGB values based on the radius of the point light, this is used to find the cross product of the light hitting the normal surface to check how intense the light should shine at a given point on the sprite

Just like the last step, I calculate the point light’s volumetric alpha based intensity to multiply the lighting normal cross product by

The end result is that the point light’s color information is layered upon each light that came before

And when the lighting information get multiplied by the color surface it creates the realistic lighting system we know and love in our games <3