Tinker & ShaderShade
Tinker Tinker
Hey, I've been tinkering with a new dynamic lighting shader for the engine, but the frame rate is taking a hit. Got any tricks to keep the glow looking great while cutting the load?
ShaderShade ShaderShade
First thing, drop the light count. Two or three lights per scene, and the rest go to a light‑map baked into the texture. If you need more dynamic, use a single spot or point light and spill its light into a lower‑res screen‑space buffer. Second, use a threshold for the bloom. Anything below, say, 0.2 stops contributing to the glow. That keeps the shader from doing unnecessary math. Third, cache the light’s world position and direction and only update it once per second or when the camera moves past a threshold. Finally, make the shader lazy: use a cheap approximation like a linear falloff instead of the expensive smoothstep for every fragment. If you’re really desperate, turn the glow into a separate pass and only render it at half resolution. That way the heavy work is still done, but you’re not pulling every pixel every frame.