[Bf-blender-cvs] [5c34e34195e] blender-v3.0-release: Fix part of T91797: Cycles CPU and GPU render differences with camera inside volume

Brecht Van Lommel noreply at git.blender.org
Thu Nov 4 19:24:59 CET 2021


Commit: 5c34e34195e2ec46c4a4e17fd2ddea784f69d628
Author: Brecht Van Lommel
Date:   Thu Nov 4 18:23:45 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rB5c34e34195e2ec46c4a4e17fd2ddea784f69d628

Fix part of T91797: Cycles CPU and GPU render differences with camera inside volume

===================================================================

M	intern/cycles/kernel/integrator/intersect_volume_stack.h

===================================================================

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)) {



More information about the Bf-blender-cvs mailing list