Fix: Cycles: Inconsistency in transparent bounces for NEE and forward path
Note: this is a partial fix, that makes NEE and forward path consistent only when `max_transparent_bounce > 0`. It is much more involved to make forward path tracing support a max transparent bounce of 0, but since we don't expect people to set up a very low number of transparent bounces, it is less important to support that specific case. Pull Request: https://projects.blender.org/blender/blender/pulls/138098
This commit is contained in:
committed by
Weizhen Huang
parent
3021d34b8c
commit
64dc9cc98c
@@ -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__
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
BIN
tests/files/render/integrator/cycles_renders/light_path_ray_depth.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/cycles_renders/light_path_ray_depth.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/render/integrator/cycles_renders/light_path_ray_length.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/cycles_renders/light_path_ray_length.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/render/integrator/cycles_renders/light_path_transparent_depth.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/cycles_renders/light_path_transparent_depth.png
(Stored with Git LFS)
Binary file not shown.
BIN
tests/files/render/integrator/cycles_renders/shadow_all_max_bounces.png
(Stored with Git LFS)
BIN
tests/files/render/integrator/cycles_renders/shadow_all_max_bounces.png
(Stored with Git LFS)
Binary file not shown.
Reference in New Issue
Block a user