In fact, indirect light colour always seems to be the polar opposite of the direct light source colour. This could be a symptom of colour values being subtracted, either in the shader or due to light probes containing negative values. I don’t know how this stuff works exactly, but it’s what I’ve figured from my tests.
Even if there are inaccuracies when light probes are calculated the result is still blatantly unacceptable, and literally dismissing this bug as a feature is a huge oversight. Please consider looking into this issue more seriously.
@Owers You might be right about this being a shader issue. The Unity Devs seem to be convinces the light probe values are correct. Maybe the way they are used is incorrect.
Hi! We do intend fixing this. The reason 4.7 didn’t have this problem, is because Beast was able to bake out L2 Spherical Harmionics for light probes. Enlighten isn’t able to do this at the moment (only L1 coefficients are supported) but we are working with Geomerics to add L2 support.
We have reopened your bug and we will either fix it by getting L2 support into Enlighten or by implementing L2 baked coefficients for direct light in light probes.
Thanks you for reporting the issue and stay tuned for the fix.
Is there a rough ETA on the fix? We’re currently at the point where we have to make the call to go back to 5.2 unless this issue is fixed within the next week or so, otherwise we might end up having to delay our launch.
@Aceria_1 It will be a few days more I think… We got a new version of Enlighten now that supports baking L2 coefficients and indirect lighting looking allright, but there is still an issue with the direct part.
If you don’t depend on the ambient probe (and your target platform has a powerful GPU), you can try this workaround in your UnityCG.cginc but you also have to remove all calls to the L2 SH evaluation:
half r(half3 normal, half4 coeffs)
{
// Let L0 be the scalar part and L1 the vector part.
half L0 = coeffs.w;
// Undo multiply by 2 from expand L1 to L2.
half3 L1 = coeffs.xyz * 0.5;
half modL1 = length(L1);
if (modL1 == 0.0)
{
return L0;
}
// Let q = (1 / 2)(1 + L1.n)[half - Lambert]
// to form q[half - Lambert term] the dot product is with normalize(L1),
// ie just with the *direction* of the L1 vector. (All the other terms take account of the length of L1.)
half q = 0.5 + 0.5 * dot(normal, normalize(L1));
//Let r = | L1 | / L0 be the ratio of the vector
half r = modL1 / L0;
return r;
}
// Reconstruct using new recommended model from Geomerics:
// This model has correct energy, dynamic range, no negative values, and significantly lower
// RMS error from ground truth than old skool Ramamoorthi - Hanrahan linear reconstruction.
// TODO optimize for performance.
half NonlinearL1ComputeChannel(half3 normal, half4 coeffs)
{
// Let L0 be the scalar part and L1 the vector part.
half L0 = coeffs.w;
// Undo multiply by 2 from expand L1 to L2.
half3 L1 = coeffs.xyz * 0.5;
half modL1 = length(L1);
if (modL1 == 0.0)
{
return L0;
}
// Let q = (1 / 2)(1 + L1.n)[half - Lambert]
// to form q[half - Lambert term] the dot product is with normalize(L1),
// ie just with the *direction* of the L1 vector. (All the other terms take account of the length of L1.)
half q = 0.5 + 0.5 * dot(normal, normalize(L1));
//Let r = | L1 | / L0 be the ratio of the vector
half r = modL1 / L0;
//Let p = 1 + 2r
half p = 1.0 + 2.0 * r;
//Let a = (1 - r) / (1 + r)
half a = (1.0 - r) / (1.0 + r);
//Then irradiance = a + (1 - a)(p + 1)q^p
return L0 * lerp((1.0 + p) * pow(q, p), 1.0, a);
}
// normal should be normalized, w=1.0
half3 SHEvalLinearL0L1 (half4 normal)
{
//unity_SHA* coefficients are in { x, y, z, DC } order.
x.r = NonlinearL1ComputeChannel(normal, unity_SHAr);
x.g = NonlinearL1ComputeChannel(normal, unity_SHAg);
x.b = NonlinearL1ComputeChannel(normal, unity_SHAb);
return x;
}
I don’t get where Unity is going. They are working in a new Light Probe grid feature but a really simple case is broken.
Please stop adding features and fix all the broken things. Please!
“We did a huge amount of new feature improvement in 2015, but we realize that some of this was at the expense of stability,” said CEO John Riccitiello, promising that 5.3.4 is a “fully stable release” .