Faking volumetric lights

Today, I decided I was going to add some volumetric lights into the game. I’ve used really clever solutions like Aura before, but I wanted something more lightweight that’ll run on lower end PCs and maybe nintendo switch… so I decided to fake it.

Start with an unlit cone -> Use the vertex position (z-axis) to set the alpha along the height of the cone -> Make the edges fade out nicely using the dot product of world normal and view direction.

It sounds so simple when I write it out like that, but it took me some time to figure out. Feels good to fake volumetric lights with just a cone and a relatively small shader. It has pretty much zero impact on performance.