Merge pull request #11694 from tagcup/lambert_normalization

Ensure that Lambert is energy conserving.
This commit is contained in:
Juan Linietsky 2017-10-01 12:18:40 -03:00 committed by GitHub
commit 99a464ceb4

View file

@ -932,7 +932,7 @@ LIGHT_SHADER_CODE
vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) ); vec3 A = 1.0 + sigma2 * (- 0.5 / (sigma2 + 0.33) + 0.17*diffuse_color / (sigma2 + 0.13) );
float B = 0.45 * sigma2 / (sigma2 + 0.09); float B = 0.45 * sigma2 / (sigma2 + 0.09);
light_amount = diffuse_color * dotNL * (A + vec3(B) * s / t) / M_PI; light_amount = dotNL * (A + vec3(B) * s / t) / M_PI;
} }
#elif defined(DIFFUSE_TOON) #elif defined(DIFFUSE_TOON)
@ -965,7 +965,7 @@ LIGHT_SHADER_CODE
} }
#else #else
//lambert //lambert
light_amount = dotNL; light_amount = dotNL / M_PI;
#endif #endif
#if defined(TRANSMISSION_USED) #if defined(TRANSMISSION_USED)