Lighting Revamp part 1 (Patreon)
Content
I received some feedback from the game. The online server is offline for now. One of the things that I took into consideration is having more variety of rooms. As it stands, the room generation is pretty cool but the novelty wears off too fast. Also, the pacing of the game is far too fast paced and so any semblance of slowly built up horror was lost in the running and quick movements. Running is okay, but normally people aren't running all the time.
This is one of the challenges with trying to translate movie like pacing to game pacing. If I make the player move slow all the time, then it becomes burdensome. Therefore I am looking to change how movement will work.
As for the graphics side, the needs to be more light play. Specifically, more spilling of lights through hallways, dimmly illuminated rooms, and spooky looking walled sections. This sounds like ray tracing, but we can't do ray tracing, at least not if I want people's computers to not melt. Here's an example reference of what I mean:

Unity has a very poor engine for fancy hyper realistic lighting. It has a built in Global Illumination setting but it is not very good and only works in screen space. The other alternative is not runtime capable and needs to be baked. Therefore I decided to work on my own custom realtime GI solution. This is not an easy task but I managed something for now.
First I began by looking at how the map is built, it's all blocks, axis aligned blocks. Therefore the light rays will be bouncing in a relatively simple blocky map. With this in mind I built a 3D voxel grid of colors that can be populated and then "painted". Here is a visualization of the grid:

The data size for such GI maps can be big so the squares are going to be relatively big. I then layered this voxel grid as x,y,z on the map so that any position can be looked up by a 3D world position:

I then made a compute shader that randomly uniformly scatters rays throughout the map. The map was originally implemented with signed distance fields but I switched to box to ray analytical intersections for performance. Here's where I was:

Over time, the light splatters stop making a difference in the room, they converge to what the room should look like. This convergence then needs to be denoised:

This is all very complex and some of the algorithms I use go way over my head. But in the end after a few days I managed something that has practical use:

The denoising was achieved by simply applying a soft blur to every surface on the map. The surfaces were picked out from the faces of the box colliders as the map is created at runtime.

Unfortunately this means that only blocky like maps will be supported with my GI shader but fortunately Backrooms level 0 (and some other ones), are entirely square.
With this I hope to make more spooky lit rooms!
Stay tuned!
Files
Previews only