+3

Deferred ambient lighting is broken. Fix included :)

Germain 7 years ago 0

Hi Joachim, we recently made the switch from legacy deferred to deferred, and we noticed all our ambient lighting broke. Initially we thought the problem was on our side, but after some searching we noticed that the "Receive Ambient Light" checkbox does not actually work. We're using version 1.36 in Unity 5.6.


After investigating, we copy pasted the following lines from the forward rendering pass to the deferred pass in a brand new "lit(basic)" shader exhibiting the issue.


indirectDiffuse += UNITY_LIGHTMODEL_AMBIENT.rgb; // Ambient Light
diffuseColor *= 1-specularMonochrome;

...

outEmission.rgb += indirectDiffuse * diffuseColor;


Image 822


Which is almost exactly what appears if we put an ambient node in SF.


This is the result:

Before

Image 823

After

Image 824