[Bf-blender-cvs] [0af1203f5df] cycles-x: Cycles X: some refinements for the make new Random Walk mode
Brecht Van Lommel
noreply at git.blender.org
Wed Aug 25 18:08:41 CEST 2021
Commit: 0af1203f5df5e8a321ae3d175dffc3f36a08112b
Author: Brecht Van Lommel
Date: Wed Aug 25 17:37:31 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB0af1203f5df5e8a321ae3d175dffc3f36a08112b
Cycles X: some refinements for the make new Random Walk mode
* Make scattering radius more similar to the old one, for easier comparison
between modes and converting existing files.
* Change default subsurface mode to Random Walk in startup file.
* Fix incorrect clamping in OSL closure.
===================================================================
M intern/cycles/kernel/closure/bssrdf.h
M intern/cycles/kernel/osl/osl_bssrdf.cpp
M source/blender/blenloader/intern/versioning_defaults.c
===================================================================
diff --git a/intern/cycles/kernel/closure/bssrdf.h b/intern/cycles/kernel/closure/bssrdf.h
index 1f730c49713..0f9278bba89 100644
--- a/intern/cycles/kernel/closure/bssrdf.h
+++ b/intern/cycles/kernel/closure/bssrdf.h
@@ -66,11 +66,12 @@ ccl_device float bssrdf_dipole_compute_alpha_prime(float rd, float fourthirdA)
ccl_device void bssrdf_setup_radius(Bssrdf *bssrdf, const ClosureType type, const float eta)
{
- /* Scale mean free path length so it gives similar looking result to older
- * to Cubic, Gaussian and Burley models. */
- bssrdf->radius *= 0.25f * M_1_PI_F;
-
- if (type != CLOSURE_BSSRDF_RANDOM_WALK_FIXED_RADIUS_ID) {
+ if (type == CLOSURE_BSSRDF_RANDOM_WALK_FIXED_RADIUS_ID) {
+ /* Scale mean free path length so it gives similar looking result to older
+ * Cubic, Gaussian and Burley models. */
+ bssrdf->radius *= 0.25f * M_1_PI_F;
+ }
+ else {
/* Adjust radius based on IOR and albedo. */
const float inv_eta = 1.0f / eta;
const float F_dr = inv_eta * (-1.440f * inv_eta + 0.710f) + 0.668f + 0.0636f * eta;
diff --git a/intern/cycles/kernel/osl/osl_bssrdf.cpp b/intern/cycles/kernel/osl/osl_bssrdf.cpp
index e346dd67d5e..5d968ed85e0 100644
--- a/intern/cycles/kernel/osl/osl_bssrdf.cpp
+++ b/intern/cycles/kernel/osl/osl_bssrdf.cpp
@@ -92,9 +92,9 @@ class CBSSRDFClosure : public CClosurePrimitive {
bssrdf->radius = params.radius;
bssrdf->albedo = params.albedo;
bssrdf->N = params.N;
- bssrdf->roughness = clamp(params.roughness, 1.01f, 3.8f);
+ bssrdf->roughness = params.roughness;
bssrdf->anisotropy = clamp(params.anisotropy, 0.0f, 0.9f);
- sd->flag |= bssrdf_setup(sd, bssrdf, (ClosureType)type, ior);
+ sd->flag |= bssrdf_setup(sd, bssrdf, (ClosureType)type, clamp(ior, 1.01f, 3.8f));
}
}
};
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 82c577d11a0..564327bc701 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -577,6 +577,10 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
bNodeSocket *roughness_socket = nodeFindSocket(node, SOCK_IN, "Roughness");
bNodeSocketValueFloat *roughness_data = roughness_socket->default_value;
roughness_data->value = 0.4f;
+ node->custom2 = SHD_SUBSURFACE_RANDOM_WALK;
+ }
+ else if (node->type == SH_NODE_SUBSURFACE_SCATTERING) {
+ node->custom1 = SHD_SUBSURFACE_RANDOM_WALK;
}
}
}
More information about the Bf-blender-cvs
mailing list