Fake Real-time Lighting
In the game Shattered (Unity - Quest 3 Mixed Reality) there is no real-time lighting. This is due to hardware limitations.
Instead some neat tricks are used for stationary lights turning on/off and a flashlight you can shine anywhere!
Lightmap Switching đź’ˇ
For stationary lights, lightmaps are pre-baked for all possible combinations of a level. This approach is highly performant and works great with automated tooling.
While I wasn’t responsible for implementing the lightmap switching system, I did help out with some of the configuration and bug fixing.
Torch 🔦
For the torch effect, I implemented lighting calculations in our custom shader and passed the torch’s position and direction as parameters.
The lighting logic was based on the “Light Casters” section from the LearnOpenGL website. I used this as a reference to correctly implement the spotlight-style falloff and intensity: https://learnopengl.com/Lighting/Light-casters
I created and applied a custom cookie texture to the torch to achieve a more realistic, torch-like lighting effect. The cookie mask was based on a blurred image of a glass crack.
Here’s an early prototype of the torch in action. It looks nearly identical to real-time lighting—the only giveaway is the lack of shadows cast by the torchlight.
Flicker / Diming Effect 🕯️
I also added dynamic light luminance control so we could create flickering or dimming effects on various light sources.
Here’s an early prototype of that effect: