diff --git a/intern/cycles/kernel/integrator/intersect_shadow.h b/intern/cycles/kernel/integrator/intersect_shadow.h index f3bfe71e17d..447fa6c7f73 100644 --- a/intern/cycles/kernel/integrator/intersect_shadow.h +++ b/intern/cycles/kernel/integrator/intersect_shadow.h @@ -59,7 +59,7 @@ ccl_device_forceinline int integrate_shadow_max_transparent_hits(KernelGlobals k const int transparent_max_bounce = kernel_data.integrator.transparent_max_bounce; const int transparent_bounce = INTEGRATOR_STATE(state, shadow_path, transparent_bounce); - return max(transparent_max_bounce - transparent_bounce - 1, 0); + return max(transparent_max_bounce - transparent_bounce, 0); } #ifdef __TRANSPARENT_SHADOWS__ diff --git a/intern/cycles/kernel/integrator/path_state.h b/intern/cycles/kernel/integrator/path_state.h index 1cfe0045ba0..016a173de1d 100644 --- a/intern/cycles/kernel/integrator/path_state.h +++ b/intern/cycles/kernel/integrator/path_state.h @@ -116,6 +116,8 @@ ccl_device_inline void path_state_next(KernelGlobals kg, flag |= PATH_RAY_TRANSPARENT; if (transparent_bounce >= kernel_data.integrator.transparent_max_bounce) { + /* FIXME: `transparent_max_bounce` could be 0, but `transparent_bounce` is at least 1 when we + * enter this path. */ flag |= PATH_RAY_TERMINATE_ON_NEXT_SURFACE; } diff --git a/intern/cycles/scene/integrator.cpp b/intern/cycles/scene/integrator.cpp index 5510ef21e22..6e4795d0e44 100644 --- a/intern/cycles/scene/integrator.cpp +++ b/intern/cycles/scene/integrator.cpp @@ -185,6 +185,8 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene device_free(device, dscene); /* integrator parameters */ + + /* Plus one so that a bounce of 0 indicates no global illumination, only direct illumination. */ kintegrator->min_bounce = min_bounce + 1; kintegrator->max_bounce = max_bounce + 1; @@ -194,7 +196,10 @@ void Integrator::device_update(Device *device, DeviceScene *dscene, Scene *scene kintegrator->max_volume_bounce = max_volume_bounce + 1; kintegrator->transparent_min_bounce = transparent_min_bounce + 1; - kintegrator->transparent_max_bounce = transparent_max_bounce + 1; + + /* Unlike other type of bounces, 0 transparent bounce means there is no transparent bounce in the + * scene. */ + kintegrator->transparent_max_bounce = transparent_max_bounce; kintegrator->ao_bounces = (ao_factor != 0.0f) ? ao_bounces : 0; kintegrator->ao_bounces_distance = ao_distance; diff --git a/tests/files/render/integrator/cycles_renders/light_path_ray_depth.png b/tests/files/render/integrator/cycles_renders/light_path_ray_depth.png index 16f3a87faab..a030e414392 100644 --- a/tests/files/render/integrator/cycles_renders/light_path_ray_depth.png +++ b/tests/files/render/integrator/cycles_renders/light_path_ray_depth.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:099e09e8e1e3a64ace9ea2796a250ee5aa33d637dcc815c9398920142673bce7 -size 28854 +oid sha256:10f9e507d61470a8019828c92aa47b1ff40173098a504804e372908451371700 +size 27204 diff --git a/tests/files/render/integrator/cycles_renders/light_path_ray_length.png b/tests/files/render/integrator/cycles_renders/light_path_ray_length.png index 8ad9d1b3bcb..27161f85c97 100644 --- a/tests/files/render/integrator/cycles_renders/light_path_ray_length.png +++ b/tests/files/render/integrator/cycles_renders/light_path_ray_length.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3d0f801c3bacd006602f59d8a6fdc4a6a314e7f0c878bf453f0969d3ba6cfc81 -size 36664 +oid sha256:d5075bace70272306e38d4f844a98eaaa502605f161c0137830f8163eda984dd +size 36674 diff --git a/tests/files/render/integrator/cycles_renders/light_path_transparent_depth.png b/tests/files/render/integrator/cycles_renders/light_path_transparent_depth.png index 12e2f7085ce..47533fa6006 100644 --- a/tests/files/render/integrator/cycles_renders/light_path_transparent_depth.png +++ b/tests/files/render/integrator/cycles_renders/light_path_transparent_depth.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4a9ff728552b99af8255f0ca48bad9adaecb164d09d7cf31c9949b3c1c5cc360 -size 16533 +oid sha256:1e78c481cbf1377f4034d85c49da4b1a9e5a9d36d97ae9140b93e8ae7cb1ee11 +size 16223 diff --git a/tests/files/render/integrator/cycles_renders/shadow_all_max_bounces.png b/tests/files/render/integrator/cycles_renders/shadow_all_max_bounces.png index a684b1f1b18..81c3602b30a 100644 --- a/tests/files/render/integrator/cycles_renders/shadow_all_max_bounces.png +++ b/tests/files/render/integrator/cycles_renders/shadow_all_max_bounces.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bf10310dc5376fcaeaf30f3e96e9a67397c811e9e202edfe8fa608b65367d61c -size 28132 +oid sha256:9689e1be006c2d32a1fa31eaaee3939d2d70f30ab6cea43ef004bd08eac649d1 +size 28103