Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2021-10-07 18:27:22 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-10-11 19:22:54 +0300
commit73a05ff9e83a31be34d32a92cd5fb4d17994e342 (patch)
tree06f0312affd92e58393216186f1519125a7c302c /source
parent40360253aefd1f3451d5b413595bcbb143425b84 (diff)
Cycles: restore Christensen-Burley SSS
There is not enough time before the release to improve Random Walk to handle all cases this was used for, so restore it for now. Since there is no more path splitting in cycles-x, this can increase noise in non-flat areas for the sample number of samples, though fewer rays will be traced also. This is fundamentally a trade-off we made in the new design and why Random Walk is a better fit. However the importance resampling we do now does help to reduce noise. Differential Revision: https://developer.blender.org/D12800
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenloader/intern/versioning_280.c2
-rw-r--r--source/blender/blenloader/intern/versioning_300.c4
-rw-r--r--source/blender/blenloader/intern/versioning_cycles.c4
-rw-r--r--source/blender/makesdna/DNA_node_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c5
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c10
6 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index d8f4d01a2e9..e6247750759 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -3718,7 +3718,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
STRNCPY(node->idname, "ShaderNodeOutputLight");
}
if (node->type == SH_NODE_BSDF_PRINCIPLED && node->custom2 == 0) {
- node->custom2 = SHD_SUBSURFACE_DIFFUSION;
+ node->custom2 = SHD_SUBSURFACE_BURLEY;
}
}
}
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index e1100fa40c4..617cd8b6c58 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -948,12 +948,12 @@ static bool seq_transform_origin_set(Sequence *seq, void *UNUSED(user_data))
static void do_version_subsurface_methods(bNode *node)
{
if (node->type == SH_NODE_SUBSURFACE_SCATTERING) {
- if (node->custom1 != SHD_SUBSURFACE_RANDOM_WALK) {
+ if (!ELEM(node->custom1, SHD_SUBSURFACE_BURLEY, SHD_SUBSURFACE_RANDOM_WALK)) {
node->custom1 = SHD_SUBSURFACE_RANDOM_WALK_FIXED_RADIUS;
}
}
else if (node->type == SH_NODE_BSDF_PRINCIPLED) {
- if (node->custom2 != SHD_SUBSURFACE_RANDOM_WALK) {
+ if (!ELEM(node->custom2, SHD_SUBSURFACE_BURLEY, SHD_SUBSURFACE_RANDOM_WALK)) {
node->custom2 = SHD_SUBSURFACE_RANDOM_WALK_FIXED_RADIUS;
}
}
diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c
index da57f27af4e..3df6af86618 100644
--- a/source/blender/blenloader/intern/versioning_cycles.c
+++ b/source/blender/blenloader/intern/versioning_cycles.c
@@ -182,8 +182,8 @@ static void displacement_principled_nodes(bNode *node)
}
}
else if (node->type == SH_NODE_BSDF_PRINCIPLED) {
- if (node->custom2 != SHD_SUBSURFACE_RANDOM_WALK_FIXED_RADIUS) {
- node->custom2 = SHD_SUBSURFACE_DIFFUSION;
+ if (node->custom2 != SHD_SUBSURFACE_RANDOM_WALK) {
+ node->custom2 = SHD_SUBSURFACE_BURLEY;
}
}
}
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 05adcc3b922..74465c4bbe0 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1877,7 +1877,7 @@ enum {
SHD_SUBSURFACE_CUBIC = 1,
SHD_SUBSURFACE_GAUSSIAN = 2,
#endif
- SHD_SUBSURFACE_DIFFUSION = 3,
+ SHD_SUBSURFACE_BURLEY = 3,
SHD_SUBSURFACE_RANDOM_WALK_FIXED_RADIUS = 4,
SHD_SUBSURFACE_RANDOM_WALK = 5,
};
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 47b2c7ea5c6..79fae204e34 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -4678,6 +4678,11 @@ static const EnumPropertyItem node_principled_distribution_items[] = {
};
static const EnumPropertyItem node_subsurface_method_items[] = {
+ {SHD_SUBSURFACE_BURLEY,
+ "BURLEY",
+ 0,
+ "Christensen-Burley",
+ "Approximation to physically based volume scattering"},
{SHD_SUBSURFACE_RANDOM_WALK_FIXED_RADIUS,
"RANDOM_WALK_FIXED_RADIUS",
0,
diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
index 06f4d1f1b79..2d3957d159e 100644
--- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
+++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
@@ -171,6 +171,7 @@ static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node)
{
bNodeSocket *sock;
int distribution = node->custom1;
+ int sss_method = node->custom2;
for (sock = node->inputs.first; sock; sock = sock->next) {
if (STREQ(sock->name, "Transmission Roughness")) {
@@ -181,6 +182,15 @@ static void node_shader_update_principled(bNodeTree *UNUSED(ntree), bNode *node)
sock->flag |= SOCK_UNAVAIL;
}
}
+
+ if (STREQ(sock->name, "Subsurface IOR") || STREQ(sock->name, "Subsurface Anisotropy")) {
+ if (sss_method == SHD_SUBSURFACE_BURLEY) {
+ sock->flag |= SOCK_UNAVAIL;
+ }
+ else {
+ sock->flag &= ~SOCK_UNAVAIL;
+ }
+ }
}
}