I have an issue i’m trying to resolve regarding a specific “Forward” Shader on an object i’m using and a point light that is next to it, when i move around in Game mode the lighting on the object flickers as seen here
In the image, the gas station object and sub objects are marked as static as they never ever move, however, when I add a point light to it, baked, realtime, doesn’t matter, the light flickers on the textures as i move around. I’ve tried modifying EVERY setting I can think of and some other advice i’ve looked at for similar issues (changing pixel count up to 10, etc). IF i change the shader on the object, it works fine, but i lose the shader effect i’m going for. (the shader in question is MK4/Forward/MK4_Building_Toon - these are shaders that came with the asset package i’m using. If i change the shader to the standard MK4_Building_Toon the light works properly and i dont receive any flickering, however i lose the effect of the standard shader (the toon type outline). Also if i change the object to not be static with the original shader the problem ceases as well.
Is there anything i’m doing wrong regarding lighting? Is this a shader issue perhaps? I’m very new to unity and optimizing lighting in general, and i’m not sure what i’m doing wrong here.
In forward rendering, the number of lights that can affect a single object is heavily limited. So, if you have more than a few lights, unity will try to choose the best ones to apply at any given time. When you move around and it appears to flicker, you are seeing that decision change.
There are a few ways to correct this. Deferred shading can handle many more lights. Breaking down your meshes into separate components allows Unity to choose lights for each component, which tends to make it more consistent. Or, if the light is really important, you can set it as important in the light settings, but if you do so for all lights, you’ll have the same problem.
Look into the information on the different rendering paths of Unity for more information on why it behaves this way.
So the only way to solve this, to use my “Forward” based shaders and forward rendering is to turn off Static Batching in the Player Settings. This then allowed the static objects to not flicker anymore with a single point light, or multiple. I’m not sure if this is a bug or what but as of unity 5.5 (and 5.6beta) this is the only solution that worked that didn’t have me completely changing the shader to a different one or turning the objects off static.
Hi,
I’m having the exact same issue in 5.6.1p1. Anyone have a solution for it? It seems to happen if you use custom lighting in your shader, with batching on.
thanks,
Mike