Cycles: make transmission color in Pricipled BSDF match the base color

since the color is applied both at entry and exit, using the square root
of the color would make the perceived color closer to the desired one.
This also makes the transition smoother when changing the `Transmission`
value in the UI, and matches the behaviour of EEVEE.
This commit is contained in:
Weizhen Huang
2023-09-18 18:08:20 +02:00
parent 742f3b233f
commit 05c053cd25
2 changed files with 2 additions and 2 deletions

View File

@@ -89,7 +89,7 @@ shader node_principled_bsdf(string distribution = "multi_ggx",
eta = backfacing() ? 1.0 / eta : eta;
TransmissionBSDF = dielectric_bsdf(
Normal, vector(0.0), reflectTint, BaseColor, r2, r2, eta, distribution);
Normal, vector(0.0), reflectTint, sqrt(BaseColor), r2, r2, eta, distribution);
BSDF = mix(BSDF, TransmissionBSDF, clamp(Transmission, 0.0, 1.0));
}

View File

@@ -301,7 +301,7 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
fresnel->reflection_tint = mix(
one_spectrum(), rgb_to_spectrum(base_color), specular_tint);
fresnel->transmission_tint = rgb_to_spectrum(base_color);
fresnel->transmission_tint = sqrt(rgb_to_spectrum(base_color));
/* setup bsdf */
sd->flag |= bsdf_microfacet_ggx_glass_setup(bsdf);