Merge branch 'blender-v4.0-release' into main

This commit is contained in:
Brecht Van Lommel 2023-10-06 20:11:54 +02:00
commit 1e567d05e9
4 changed files with 29 additions and 23 deletions

View File

@ -243,11 +243,15 @@ def do_versions(self):
layer.samples *= layer.samples
cscene["use_square_samples"] = False
# Disable light tree for existing scenes.
if version <= (3, 5, 3):
cscene = scene.cycles
# Disable light tree for existing scenes.
if not cscene.is_property_set("use_light_tree"):
cscene.use_light_tree = False
# Sampling pattern settings are hidden behind a debug menu. Switch to the
# default faster and fully featured (Supports Scrambling Distance)
# Tabulated Sobol.
cscene.sampling_pattern = 'TABULATED_SOBOL'
# Lamps
for light in bpy.data.lights:

View File

@ -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;

View File

@ -74,7 +74,7 @@ shader node_principled_bsdf(string distribution = "multi_ggx",
SubsurfaceScale * SubsurfaceRadius,
BaseColor,
"roughness",
Roughness,
r2,
"ior",
subsurface_ior,
"anisotropy",
@ -82,14 +82,16 @@ shader node_principled_bsdf(string distribution = "multi_ggx",
BSDF = mix(BSDF, BaseColor * SubsurfBSDF, subsurface_weight);
}
/* Apply specular tint */
color F0 = f0 * specular_tint;
color F90 = color(1.0);
if (eta != 1.0) {
/* Apply specular tint */
color F0 = f0 * specular_tint;
color F90 = color(1.0);
BSDF = layer(
generalized_schlick_bsdf(
Normal, T, color(1.0), color(0.0), alpha_x, alpha_y, F0, F90, -eta, distribution),
BSDF);
BSDF = layer(
generalized_schlick_bsdf(
Normal, T, color(1.0), color(0.0), alpha_x, alpha_y, F0, F90, -eta, distribution),
BSDF);
}
}
closure color TransmissionBSDF = 0;

View File

@ -327,8 +327,19 @@ 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) {
if (reflective_caustics && eta != 1.0f) {
ccl_private MicrofacetBsdf *bsdf = (ccl_private MicrofacetBsdf *)bsdf_alloc(
sd, sizeof(MicrofacetBsdf), weight);
ccl_private FresnelGeneralizedSchlick *fresnel =
@ -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);