[Bf-blender-cvs] [c1d30dbfe3a] cycles-x: Cycles X: Bring back per-object GI approximation AO distance
Sergey Sharybin
noreply at git.blender.org
Thu Aug 5 17:06:50 CEST 2021
Commit: c1d30dbfe3a431b90ddcac6ae62481d8e57a08e5
Author: Sergey Sharybin
Date: Thu Aug 5 12:30:56 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBc1d30dbfe3a431b90ddcac6ae62481d8e57a08e5
Cycles X: Bring back per-object GI approximation AO distance
Measure no performance impact beyond noise deviation on RTX6000:
```
cycles-x new
barbershop_interior 14.4251s 14.2849s
bmw27 9.5182s 9.1225s
classroom 17.1786s 17.1967s
junkshop 18.3849s 18.8356s
monster 9.9017s 9.5428s
pabellon 8.0902s 8.1711s
```
Differential Revision: https://developer.blender.org/D12138
===================================================================
M intern/cycles/kernel/integrator/integrator_intersect_closest.h
===================================================================
diff --git a/intern/cycles/kernel/integrator/integrator_intersect_closest.h b/intern/cycles/kernel/integrator/integrator_intersect_closest.h
index 493e1bfc5f5..d92e097e783 100644
--- a/intern/cycles/kernel/integrator/integrator_intersect_closest.h
+++ b/intern/cycles/kernel/integrator/integrator_intersect_closest.h
@@ -152,11 +152,21 @@ ccl_device void integrator_intersect_closest(INTEGRATOR_STATE_ARGS)
integrator_state_read_ray(INTEGRATOR_STATE_PASS, &ray);
kernel_assert(ray.t != 0.0f);
- uint visibility = path_state_ray_visibility(INTEGRATOR_STATE_PASS);
+ const uint visibility = path_state_ray_visibility(INTEGRATOR_STATE_PASS);
+ const int last_isect_prim = INTEGRATOR_STATE(isect, prim);
+ const int last_isect_object = INTEGRATOR_STATE(isect, object);
/* Trick to use short AO rays to approximate indirect light at the end of the path. */
if (path_state_ao_bounce(INTEGRATOR_STATE_PASS)) {
ray.t = kernel_data.integrator.ao_bounces_distance;
+
+ const int last_object = last_isect_object != OBJECT_NONE ?
+ last_isect_object :
+ kernel_tex_fetch(__prim_object, last_isect_prim);
+ const float object_ao_distance = kernel_tex_fetch(__objects, last_object).ao_distance;
+ if (object_ao_distance != 0.0f) {
+ ray.t = object_ao_distance;
+ }
}
/* Scene Intersection. */
@@ -172,11 +182,9 @@ ccl_device void integrator_intersect_closest(INTEGRATOR_STATE_ARGS)
if (kernel_data.integrator.use_lamp_mis && !(INTEGRATOR_STATE(path, flag) & PATH_RAY_CAMERA)) {
/* NOTE: if we make lights visible to camera rays, we'll need to initialize
* these in the path_state_init. */
- const int last_prim = INTEGRATOR_STATE(isect, prim);
- const int last_object = INTEGRATOR_STATE(isect, object);
const int last_type = INTEGRATOR_STATE(isect, type);
- hit = lights_intersect(kg, &ray, &isect, last_prim, last_object, last_type) || hit;
+ hit = lights_intersect(kg, &ray, &isect, last_isect_prim, last_isect_object, last_type) || hit;
}
/* Write intersection result into global integrator state memory. */
More information about the Bf-blender-cvs
mailing list