Fix Cycles SVM not using IOR Level for Subsurface entry
Make it consistent with OSL. Pull Request: https://projects.blender.org/blender/blender/pulls/113192
This commit is contained in:
parent
61a8d1f7d0
commit
33cbe4c108
|
@ -831,7 +831,7 @@ ccl_device void osl_closure_bssrdf_setup(KernelGlobals kg,
|
|||
/* create one closure per color channel */
|
||||
bssrdf->albedo = closure->albedo;
|
||||
bssrdf->N = maybe_ensure_valid_specular_reflection(sd, closure->N);
|
||||
bssrdf->alpha = sqr(closure->roughness);
|
||||
bssrdf->alpha = closure->roughness;
|
||||
bssrdf->ior = closure->ior;
|
||||
bssrdf->anisotropy = closure->anisotropy;
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ shader node_principled_bsdf(string distribution = "multi_ggx",
|
|||
SubsurfaceScale * SubsurfaceRadius,
|
||||
BaseColor,
|
||||
"roughness",
|
||||
Roughness,
|
||||
r2,
|
||||
"ior",
|
||||
subsurface_ior,
|
||||
"anisotropy",
|
||||
|
|
|
@ -327,6 +327,17 @@ ccl_device
|
|||
}
|
||||
}
|
||||
|
||||
/* Apply IOR adjustment */
|
||||
float eta = ior;
|
||||
float f0 = F0_from_ior(eta);
|
||||
if (specular_ior_level != 0.5f) {
|
||||
f0 *= 2.0f * specular_ior_level;
|
||||
eta = ior_from_F0(f0);
|
||||
if (ior < 1.0f) {
|
||||
eta = 1.0f / eta;
|
||||
}
|
||||
}
|
||||
|
||||
/* Specular component */
|
||||
if (reflective_caustics) {
|
||||
ccl_private MicrofacetBsdf *bsdf = (ccl_private MicrofacetBsdf *)bsdf_alloc(
|
||||
|
@ -337,17 +348,6 @@ ccl_device
|
|||
NULL;
|
||||
|
||||
if (bsdf && fresnel) {
|
||||
/* Apply IOR adjustment */
|
||||
float eta = ior;
|
||||
float f0 = F0_from_ior(eta);
|
||||
if (specular_ior_level != 0.5f) {
|
||||
f0 *= 2.0f * specular_ior_level;
|
||||
eta = ior_from_F0(f0);
|
||||
if (ior < 1.0f) {
|
||||
eta = 1.0f / eta;
|
||||
}
|
||||
}
|
||||
|
||||
bsdf->N = valid_reflection_N;
|
||||
bsdf->ior = eta;
|
||||
bsdf->T = T;
|
||||
|
@ -383,7 +383,7 @@ ccl_device
|
|||
bssrdf->albedo = rgb_to_spectrum(base_color);
|
||||
bssrdf->N = maybe_ensure_valid_specular_reflection(sd, N);
|
||||
bssrdf->alpha = sqr(roughness);
|
||||
bssrdf->ior = ior;
|
||||
bssrdf->ior = eta;
|
||||
bssrdf->anisotropy = stack_load_float(stack, data_subsurf.w);
|
||||
if (subsurface_method == CLOSURE_BSSRDF_RANDOM_WALK_SKIN_ID) {
|
||||
bssrdf->ior = stack_load_float(stack, data_subsurf.x);
|
||||
|
|
Loading…
Reference in New Issue