From aed9b6faee39f8049ca9a072f37d2c0c2ea3a760 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 21 Apr 2021 17:32:32 +0200 Subject: Fix some Cycles random walk SSS precision issues with small radius --- intern/cycles/kernel/kernel_subsurface.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/intern/cycles/kernel/kernel_subsurface.h b/intern/cycles/kernel/kernel_subsurface.h index c75958e79c5..0a56f867158 100644 --- a/intern/cycles/kernel/kernel_subsurface.h +++ b/intern/cycles/kernel/kernel_subsurface.h @@ -605,6 +605,13 @@ ccl_device_noinline if (hit) { t = ray->t; } + else if (bounce == 0) { + /* Restore original position if nothing was hit after the first bounce. + * Otherwise if the ray_offset() to avoid self-intersection is relatively + * large compared to the scattering radius, we go never backup high enough + * to exit the surface. */ + ray->P = sd->P; + } /* Advance to new scatter location. */ ray->P += t * ray->D; -- cgit v1.2.3