diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-11-04 20:23:45 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-11-04 21:03:49 +0300 |
commit | 5c34e34195e2ec46c4a4e17fd2ddea784f69d628 (patch) | |
tree | 8f15c7a3bd62ec87f8ec9932689026b2c6f62c46 /intern/cycles/kernel/integrator | |
parent | c7fcc50842d85664d2b07c32b181951ea7661440 (diff) |
Fix part of T91797: Cycles CPU and GPU render differences with camera inside volume
Diffstat (limited to 'intern/cycles/kernel/integrator')
-rw-r--r-- | intern/cycles/kernel/integrator/intersect_volume_stack.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/intern/cycles/kernel/integrator/intersect_volume_stack.h b/intern/cycles/kernel/integrator/intersect_volume_stack.h index 1c91318ff9c..dd0587db9d8 100644 --- a/intern/cycles/kernel/integrator/intersect_volume_stack.h +++ b/intern/cycles/kernel/integrator/intersect_volume_stack.h @@ -83,6 +83,10 @@ ccl_device void integrator_intersect_volume_stack(KernelGlobals kg, IntegratorSt Ray volume_ray ccl_optional_struct_init; integrator_state_read_ray(kg, state, &volume_ray); + + /* Trace ray in random direction. Any direction works, Z up is a guess to get the + * fewest hits. */ + volume_ray.D = make_float3(0.0f, 0.0f, 1.0f); volume_ray.t = FLT_MAX; const uint visibility = (INTEGRATOR_STATE(state, path, flag) & PATH_RAY_ALL_VISIBILITY); @@ -147,7 +151,7 @@ ccl_device void integrator_intersect_volume_stack(KernelGlobals kg, IntegratorSt int enclosed_volumes[MAX_VOLUME_STACK_SIZE]; int step = 0; - while (stack_index < volume_stack_size - 1 && enclosed_index < volume_stack_size - 1 && + while (stack_index < volume_stack_size - 1 && enclosed_index < MAX_VOLUME_STACK_SIZE - 1 && step < 2 * volume_stack_size) { Intersection isect; if (!scene_intersect_volume(kg, &volume_ray, &isect, visibility)) { |