How to tell Unity to stop rendering everything once per light ?

How to tell Unity to stop rendering everything once per light ?

I have profiled our Unity app using Unity 5.2.1 and it turns out that our scene is drawn at least twice. Once for the ambient light and once for diffuse light. While all of this sounds like “Deferred lighting” and definitely not deferred rendering (all lights and rendering paths are set up to use Forward btw) it is making everything render twice as slow on mobile devices. I mean, combining ambient and a diffuse light in a single pixel shader pass is way more faster than rendering everything twice, and the second time with blending enabled even.

Is there any way/option/setting that can change this behavior that I do’t know of ?

I think I just answered my own question. By profiling drawcalls on iOS, I observed that if using a fully custom shader (not just a surface shader), you are disabling Unity’s deferred rendering thing, thus rendering objects just once.

1 Like