Cycles: Fix the AO replacement option in the split kernel
authorLukas Stockner <lukas.stockner@freenet.de>
Mon, 10 Apr 2017 22:53:31 +0000 (00:53 +0200)
committerLukas Stockner <lukas.stockner@freenet.de>
Mon, 10 Apr 2017 23:07:49 +0000 (01:07 +0200)
Currently the code for it was inside the hair-specific part, so it wouldn't be enabled in hairless renders.

intern/cycles/kernel/split/kernel_scene_intersect.h

index 684760eedeeb0bd65e58e56ce03ea62009abc3c6..5dc94caec853480f363d04660d45a9db70c75fee 100644 (file)
@@ -59,6 +59,11 @@ ccl_device void kernel_scene_intersect(KernelGlobals *kg)
        /* intersect scene */
        uint visibility = path_state_ray_visibility(kg, &state);
 
+       if(state.bounce > kernel_data.integrator.ao_bounces) {
+               visibility = PATH_RAY_SHADOW;
+               ray.t = kernel_data.background.ao_distance;
+       }
+
 #ifdef __HAIR__
        float difl = 0.0f, extmax = 0.0f;
        uint lcg_state = 0;
@@ -75,11 +80,6 @@ ccl_device void kernel_scene_intersect(KernelGlobals *kg)
                lcg_state = lcg_state_init(&rng, state.rng_offset, state.sample, 0x51633e2d);
        }
 
-       if(state.bounce > kernel_data.integrator.ao_bounces) {
-               visibility = PATH_RAY_SHADOW;
-               ray.t = kernel_data.background.ao_distance;
-       }
-
        bool hit = scene_intersect(kg, ray, visibility, &isect, &lcg_state, difl, extmax);
 #else
        bool hit = scene_intersect(kg, ray, visibility, &isect, NULL, 0.0f, 0.0f);