Merge pull request #11807 from tagcup/roughness_metallic_limiting_cases
Fix the condition when specular light calculation is avoided (should …
This commit is contained in:
commit
a2a4f9a62a
@ -959,6 +959,7 @@ LIGHT_SHADER_CODE
|
||||
float NdotV = dot(N, V);
|
||||
float cNdotV = max(NdotV, 0.0);
|
||||
|
||||
if (metallic < 1.0) {
|
||||
#if defined(DIFFUSE_OREN_NAYAR)
|
||||
vec3 diffuse_brdf_NL;
|
||||
#else
|
||||
@ -1030,9 +1031,10 @@ LIGHT_SHADER_CODE
|
||||
float rim_light = pow(1.0-cNdotV, (1.0-roughness)*16.0);
|
||||
diffuse_light += rim_light * rim * mix(vec3(1.0),diffuse_color,rim_tint) * light_color;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (roughness > 0.0) {
|
||||
if (roughness < 1.0) {
|
||||
|
||||
|
||||
// D
|
||||
@ -1099,7 +1101,7 @@ LIGHT_SHADER_CODE
|
||||
#endif
|
||||
|
||||
#if defined(LIGHT_USE_CLEARCOAT)
|
||||
|
||||
if (clearcoat_gloss > 0.0) {
|
||||
# if !defined(SPECULAR_SCHLICK_GGX) && !defined(SPECULAR_BLINN)
|
||||
vec3 H = normalize(V + L);
|
||||
# endif
|
||||
@ -1114,6 +1116,7 @@ LIGHT_SHADER_CODE
|
||||
|
||||
|
||||
specular_light += .25*clearcoat*Gr*Fr*Dr;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1985,7 +1988,7 @@ FRAGMENT_SHADER_CODE
|
||||
|
||||
|
||||
//energy conservation
|
||||
diffuse_light *= 1.0-metallic; // TODO: avoid diffuse and ambient light calculations when metallic == 1
|
||||
diffuse_light *= 1.0-metallic; // TODO: avoid all diffuse and ambient light calculations when metallic == 1 up to this point
|
||||
ambient_light *= 1.0-metallic;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user