Fix #133229: Remove camera size optimization from SSS shader in Cycles

In Cycles, the subsurface scattering shader will switch to a
diffuse shader under a few different conditions to improve performance
and reduce noise.

This commit removes the "switch back to diffuse if the scattering
radius is less than a quarter of a pixel" optimization because in some
scenes, this can result in noticable lines as the shader transitions
between subsurface scattering and diffuse.

Pull Request: https://projects.blender.org/blender/blender/pulls/133245
This commit is contained in:
Alaska 2025-01-21 04:31:43 +01:00 committed by Alaska
parent bd3bc46b42
commit b9ebd96539
2 changed files with 12 additions and 12 deletions

View file

@ -305,20 +305,20 @@ ccl_device int bssrdf_setup(ccl_private ShaderData *sd,
int bssrdf_channels = SPECTRUM_CHANNELS; int bssrdf_channels = SPECTRUM_CHANNELS;
Spectrum diffuse_weight = zero_spectrum(); Spectrum diffuse_weight = zero_spectrum();
/* Fall back to diffuse if the radius is smaller than a quarter pixel. */
float min_radius = max(0.25f * sd->dP, BSSRDF_MIN_RADIUS);
if (path_flag & PATH_RAY_DIFFUSE_ANCESTOR) { if (path_flag & PATH_RAY_DIFFUSE_ANCESTOR) {
/* Always fall back to diffuse after a diffuse ancestor. Can't see it well then and adds /* Always fall back to diffuse after a diffuse ancestor. Can't see it that well and it adds
* considerable noise due to probabilities of continuing the path getting lower and lower. */ * considerable noise due to probabilities of continuing the path getting lower and lower. */
min_radius = FLT_MAX; bssrdf_channels = 0;
diffuse_weight = bssrdf->weight;
} }
else {
FOREACH_SPECTRUM_CHANNEL (i) { FOREACH_SPECTRUM_CHANNEL (i) {
if (GET_SPECTRUM_CHANNEL(bssrdf->radius, i) < min_radius) { if (GET_SPECTRUM_CHANNEL(bssrdf->radius, i) < BSSRDF_MIN_RADIUS) {
GET_SPECTRUM_CHANNEL(diffuse_weight, i) = GET_SPECTRUM_CHANNEL(bssrdf->weight, i); GET_SPECTRUM_CHANNEL(diffuse_weight, i) = GET_SPECTRUM_CHANNEL(bssrdf->weight, i);
GET_SPECTRUM_CHANNEL(bssrdf->weight, i) = 0.0f; GET_SPECTRUM_CHANNEL(bssrdf->weight, i) = 0.0f;
GET_SPECTRUM_CHANNEL(bssrdf->radius, i) = 0.0f; GET_SPECTRUM_CHANNEL(bssrdf->radius, i) = 0.0f;
bssrdf_channels--; bssrdf_channels--;
}
} }
} }

@ -1 +1 @@
Subproject commit 2e9d939dd2d8ec017888c497742c1f138755f189 Subproject commit c94e0deff0da1742c9afc2cff9b896b6465737df