[Bf-blender-cvs] [183a706239d] cycles_texture_cache: Cycles: Added ray differential calculation for AO
Stefan Werner
noreply at git.blender.org
Mon Nov 27 20:40:24 CET 2017
Commit: 183a706239d0814ba433463b9f44654c5fe974cc
Author: Stefan Werner
Date: Fri May 12 16:22:30 2017 +0200
Branches: cycles_texture_cache
https://developer.blender.org/rB183a706239d0814ba433463b9f44654c5fe974cc
Cycles: Added ray differential calculation for AO
===================================================================
M intern/cycles/kernel/kernel_path.h
M intern/cycles/kernel/kernel_path_branched.h
===================================================================
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index c2421c1ec18..1ea261012de 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -376,8 +376,14 @@ ccl_device_noinline void kernel_path_ao(KernelGlobals *kg,
light_ray.D = ao_D;
light_ray.t = kernel_data.background.ao_distance;
light_ray.time = sd->time;
+#ifdef __RAY_DIFFERENTIALS__
light_ray.dP = sd->dP;
- light_ray.dD = differential3_zero();
+ /* This is how pbrt v3 implements differentials for diffuse bounces */
+ float3 a, b;
+ make_orthonormals(ao_D, &a, &b);
+ light_ray.dD.dx = normalize(ao_D + 0.1f * a);
+ light_ray.dD.dy = normalize(ao_D + 0.1f * b);
+#endif /* __RAY_DIFFERENTIALS__ */
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &ao_shadow)) {
path_radiance_accum_ao(L, state, throughput, ao_alpha, ao_bsdf, ao_shadow);
diff --git a/intern/cycles/kernel/kernel_path_branched.h b/intern/cycles/kernel/kernel_path_branched.h
index 9996f52f9a4..b4782c73576 100644
--- a/intern/cycles/kernel/kernel_path_branched.h
+++ b/intern/cycles/kernel/kernel_path_branched.h
@@ -49,8 +49,14 @@ ccl_device_inline void kernel_branched_path_ao(KernelGlobals *kg,
light_ray.D = ao_D;
light_ray.t = kernel_data.background.ao_distance;
light_ray.time = sd->time;
+#ifdef __RAY_DIFFERENTIALS__
light_ray.dP = sd->dP;
- light_ray.dD = differential3_zero();
+ /* This is how pbrt v3 implements differentials for diffuse bounces */
+ float3 a, b;
+ make_orthonormals(ao_D, &a, &b);
+ light_ray.dD.dx = normalize(ao_D + 0.1f * a);
+ light_ray.dD.dy = normalize(ao_D + 0.1f * b);
+#endif /* __RAY_DIFFERENTIALS__ */
if(!shadow_blocked(kg, sd, emission_sd, state, &light_ray, &ao_shadow)) {
path_radiance_accum_ao(L, state, throughput*num_samples_inv, ao_alpha, ao_bsdf, ao_shadow);
More information about the Bf-blender-cvs
mailing list