- Home /
Lighting breaks when zooming in
I have been experiencing some weird behaviors with lighting in my scene lately, depending on the my zoom level (in editor), my objects get completely blown out from the lights, really bright:
NORMAL
BROKEN
I should mention that I'm using custom shaders, but i never had that problem before. What could I have broken in my shaders that would introduce this behavior? They're nothing fancy, just some custom vertex lit shaders, and the only thing I can think of is maybe I'm not using #define UNITY_PASS_FORWARDBASE correctly, or something like this. I could be completely wrong of course :)
Any tips would be very welcomed, as I have no idea why it's happening all of a sudden...
Thanks guys!
Stephane
Answer by Kryptos · Sep 03, 2012 at 09:05 AM
This looks like double lighting. Can you show use your shaders?
Also note that since Unity 3.5.1, realtime lights work differently (fixing a bug):
In Unity 3.4 realtime lights were not affecting static objects. In Unity 3.5 realtime lights always affect static and dynamic objects.
The result of this is that if you had previously setup your lighting to work around this bug, then you will now get worse performance as you will receive the lighting twice. It will also look different since your lights will be added twice to the scene.
The correct way to use these lights is to use a single auto directional light and remove the realtime only light.
Nicolas, I wasn't aware of the change since Unity 3.5.1, thx for the heads-up :) This was my problem though, my lighting wasn't setup to work around that bug. I'm pretty sure I fixed it by changing all my Passes to "Tags { "Light$$anonymous$$ode" = "ForwardBase" }" ins$$anonymous$$d of "Tags { "Light$$anonymous$$ode" = "Vertex" }" and adding "#define UNITY_PASS_FORWARDBASE".
Now my lighting doesn't change or get blown-up anymore when zoo$$anonymous$$g in so that must have been it. I had some shaders using Vertex Light$$anonymous$$ode and some other using ForwardBase, while the source code had ""#define UNITY_PASS_FORWARDBASE" setup, and I think it was messing things up for me. Although I cannot be sure, it's the only explanation I can come-up with since everything seems to be working fine now!
Yay :)