Cycles: Speed up Principled BSDF when IOR = 1.0 #111586

Manually merged
Brecht Van Lommel merged 1 commits from Alaska/blender:skip_specular into main 2023-10-06 20:12:40 +02:00
2 changed files with 14 additions and 13 deletions

View File

@ -61,20 +61,21 @@ shader node_principled_bsdf(string distribution = "multi_ggx",
else {
BSDF = diffuse_color * diffuse(Normal);
}
if (IOR != 1.0) {
color f0 = color(F0_from_ior(IOR));
color f90 = color(1.0);
color f0 = color(F0_from_ior(IOR));
color f90 = color(1.0);
/* Apply specular tint */
float m_cdlum = luminance(BaseColor);
color m_ctint = m_cdlum > 0.0 ? BaseColor / m_cdlum : color(1.0);
color specTint = mix(color(1.0), m_ctint, SpecularTint);
f0 *= (specTint * 2.0 * Specular);
/* Apply specular tint */
float m_cdlum = luminance(BaseColor);
color m_ctint = m_cdlum > 0.0 ? BaseColor / m_cdlum : color(1.0);
color specTint = mix(color(1.0), m_ctint, SpecularTint);
f0 *= (specTint * 2.0 * Specular);
BSDF = layer(
generalized_schlick_bsdf(
Normal, T, color(1.0), color(0.0), alpha_x, alpha_y, f0, f90, -IOR, distribution),
BSDF);
BSDF = layer(
generalized_schlick_bsdf(
Normal, T, color(1.0), color(0.0), alpha_x, alpha_y, f0, f90, -IOR, distribution),
BSDF);
}
}
closure color TransmissionBSDF = 0;

View File

@ -263,7 +263,7 @@ ccl_device_noinline int svm_node_closure_bsdf(KernelGlobals kg,
}
/* Specular component */
if (reflective_caustics) {
if (reflective_caustics && eta != 1.0f) {
ccl_private MicrofacetBsdf *bsdf = (ccl_private MicrofacetBsdf *)bsdf_alloc(
sd, sizeof(MicrofacetBsdf), weight);
ccl_private FresnelGeneralizedSchlick *fresnel =