Lightweight Volumetric Lights
Personal Project
Faked Volumetric Lights
Volumetric Light Materials
To create volumetric lights that are lightweight and efficient to run but are still convincing I faked the lights by creating a material shader. In order to create a volumetric lighting effect I used a transparent shader that simulates light beams without expensive real-time volumetrics. The key idea is to make the light fade out as the camera gets close and to use scrolling 3D textures to simulate floating dust.
Fading Out Near Camera
I achieved the fade effect by calculating the distance between the camera and the light volume. A cutoff value determines when the light material should disappear. In the shader, I subtracted the camera distance from this cutoff, then use that value to fade out the alpha. If the camera is far away, the light is fully visible. If it gets too close, the light smoothly disappears, this prevents clipping when the player passes through the light volume which would break the illusion.
Creating Dust
To make the light feel more realistic, I multiplied the albedo by a 3D noise texture that moves over time. This gives the effect of dust floating in the air. We scroll the texture by adding time to the texture’s UV coordinates in a specific direction. Since it's a 3D texture, we sample it based on world position and time, creating a sense of depth and movement.
For non-static lights, I needed to make sure the dust movement reacts naturally to the light's position, such as in the case with a flashlight. Since the light itself moves, you don’t want the dust pattern to look "stuck in place." Instead, it should move with the light while still maintaining an organic floating effect. In order to do this I sampled the 3D noise texture based on fixed world coordinates and included the light’s world position in the calculation.