This week I worked on adding point lights, spotlights, and post-processing effects in the Unity SRP maze project.
The first thing I did was create a light source in the maze, by adding lamps, as a starting point to implement point and spot light-related shadows.
The initial implementation didn’t work very well, highlighting issues with the pixelated shadow effect, creating shadows on the walls, and in corners, where there shouldn’t be any.
I ended up changing how the world pixel position was being calculated, taking into account the light direction. If the position is facing the light, move it towards the light, else if it’s not, move it away.
Doing this per light corrected the issues with the shadows and also helped created more accurate looking lighting.
I also worked on post-processing effects to understand how to integrate them into SRP.
Since the lighting from the lamps looked a little plain, I wanted to make them stand out by having them glow from a simple bloom effect.
The effect is done by resizing the screen image and blurring the pixels in several passes. The bright and dark areas of the blurred image are then exaggerated, which is then combined with the final screen to create the glow.
You can think of it as adding filters and effects in an image editing tool like Photoshop or GIMP.
Just for fun, I experimented with a pixelated post-processing effect.
The effect defeats the purpose of maintaining the pixel art shadows since it hides them. But it was a fun experiment to help me understand how to combine post-processing effects in SRP.
I’ve always felt that I’ve had to leave it up to Unity with how some things work. Making guesses, or even coming up with solutions that feel more like a hack than an actual solution.
But working at this level of code in SRP (not quite low and not quite high) to come up with a solution for my own rendering requirements, has been a nice and welcome change.
Next, I’m turning my attention to gameplay and improving the maze generation to make this into a playable game and encourage more specific effects for me to create in SRP.