SamuKata
sgthale
sgthale

patreon


Lighting Revamp part 2

5 compute shaders and several hours debugging the system and I'm proud to say that it is looking very promising for use in the game!

As I said in the previous devpost, I needed a way to have sexy better looking lighting. Unity does not offer a realtime global illumination solution so I had to build my own from scratch. It was a bit complicated but it works very well.

As I stated as well, the new GI system works by randomly sampling the map and then denoising the result to produce pseudo-ray traced lighting. This makes the spilling of lights across hallways and corridors much more interesting. Here's a slow motion example of the system working in action:

Of course this baking of light does happen much faster over time and I am continuing to optimize it for lower end PCs. It's not actually that difficult.

One of the problems with this system is the fact that I had to limit the viewing distance of where it stores the light result. The system uses a 3D voxel grid of colors to save/denoise raymarched points. This means that it was limited to only rendering in a small space. Therefore the solution I applied to this was to offset the voxel grid whenever you wanted to reach a different area:

In this instance, all the grid values are offset by some amount in the x or z direction when I get far away enough from the center of the voxel grid. of course this also means that you can "walk away" from a previously rendered result. This means that if I went BACK to that initial position, the baking would have to happen again:

So in a sense there is a "view distance" for the baking. I'm doing my best to hide the generation so you don't see lights "pop" into view.

The results so far are amazing. Here some examples, left is new, right is old:

Also, the system works with regular Unity lights so there is no problem adding regular Unity lights into the scene. Shadows also work and so does any sort of colored lights.

Stay tuned!

Lighting Revamp part 2

More Creators