Fix Principled BSDF specular color for black base color

Specular color is set to black instead of white inside the Principled BSDF
when the base color is set to fully black. This is contradictory to the sample
code of the Disney BRDF in BRDF Explorer. This patch aligns both
implementations.

Differential Revision: https://developer.blender.org/D10448
This commit is contained in:
Pascal Schön
2021-02-22 17:50:13 +01:00
committed by Brecht Van Lommel
parent 32073993a8
commit 277b4f4b93
3 changed files with 3 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ shader node_principled_bsdf(string distribution = "Multiscatter GGX",
float m_cdlum = luminance(BaseColor);
color m_ctint = m_cdlum > 0.0 ? BaseColor / m_cdlum :
color(0.0, 0.0, 0.0); // normalize lum. to isolate hue+sat
color(1.0, 1.0, 1.0); // normalize lum. to isolate hue+sat
/* rotate tangent */
if (AnisotropicRotation != 0.0)

View File

@@ -308,7 +308,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg,
float3 m_ctint = m_cdlum > 0.0f ?
base_color / m_cdlum :
make_float3(
0.0f, 0.0f, 0.0f); // normalize lum. to isolate hue+sat
1.0f, 1.0f, 1.0f); // normalize lum. to isolate hue+sat
float3 tmp_col = make_float3(1.0f, 1.0f, 1.0f) * (1.0f - specular_tint) +
m_ctint * specular_tint;

View File

@@ -2,7 +2,7 @@
vec3 tint_from_color(vec3 color)
{
float lum = dot(color, vec3(0.3, 0.6, 0.1)); /* luminance approx. */
return (lum > 0.0) ? color / lum : vec3(0.0); /* normalize lum. to isolate hue+sat */
return (lum > 0.0) ? color / lum : vec3(1.0); /* normalize lum. to isolate hue+sat */
}
float principled_sheen(float NV)