diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-03-19 15:14:56 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-03-19 15:20:42 +0300 |
commit | a7f427074873ecf5a11a7e866174f22b47bb26a0 (patch) | |
tree | f37e1005fcda6c19bf142d9b91d9de847d993c04 /intern/cycles/kernel/kernel_subsurface.h | |
parent | d235f6a48e9402d0e0835441bee1389b70832ba6 (diff) |
Fix Cycles NaN assert in random walk SSS due to very small throughput
Now terminate if there are many bounces and the throughput gets so small
that we get precision issues.
Diffstat (limited to 'intern/cycles/kernel/kernel_subsurface.h')
-rw-r--r-- | intern/cycles/kernel/kernel_subsurface.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/intern/cycles/kernel/kernel_subsurface.h b/intern/cycles/kernel/kernel_subsurface.h index 55bbe7f95db..c75958e79c5 100644 --- a/intern/cycles/kernel/kernel_subsurface.h +++ b/intern/cycles/kernel/kernel_subsurface.h @@ -640,6 +640,12 @@ ccl_device_noinline /* If we hit the surface, we are done. */ break; } + else if (throughput.x < VOLUME_THROUGHPUT_EPSILON && + throughput.y < VOLUME_THROUGHPUT_EPSILON && + throughput.z < VOLUME_THROUGHPUT_EPSILON) { + /* Avoid unnecessary work and precision issue when throughput gets really small. */ + break; + } } kernel_assert(isfinite_safe(throughput.x) && isfinite_safe(throughput.y) && |