[Bf-blender-cvs] [f4767bcd3cf] cycles_path_guiding: Guiding: Adding support for emissive volumes

Sebastian Herholz noreply at git.blender.org
Tue Sep 6 10:26:54 CEST 2022


Commit: f4767bcd3cf1ca38a93f5ba1f9780bd747fed011
Author: Sebastian Herholz
Date:   Tue Sep 6 10:26:52 2022 +0200
Branches: cycles_path_guiding
https://developer.blender.org/rBf4767bcd3cf1ca38a93f5ba1f9780bd747fed011

Guiding: Adding support for emissive volumes

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

M	intern/cycles/kernel/integrator/guiding.h
M	intern/cycles/kernel/integrator/shade_volume.h

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

diff --git a/intern/cycles/kernel/integrator/guiding.h b/intern/cycles/kernel/integrator/guiding.h
index 91215e01826..de49da2d216 100644
--- a/intern/cycles/kernel/integrator/guiding.h
+++ b/intern/cycles/kernel/integrator/guiding.h
@@ -278,6 +278,22 @@ ccl_device_forceinline void guiding_record_surface_emission(KernelGlobals kg,
 #endif
 }
 
+ccl_device_forceinline void guiding_record_volume_emission(KernelGlobals kg,
+                                                            IntegratorState state,
+                                                            const Spectrum Le)
+{
+#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 1
+  if (!kernel_data.integrator.use_guiding) {
+    return;
+  }
+
+  const float3 Le_rgb = spectrum_to_rgb(Le);
+
+  openpgl::cpp::SetDirectContribution(state->guiding.path_segment, guiding_vec3f(Le_rgb));
+  openpgl::cpp::SetMiWeight(state->guiding.path_segment, 1.0f);
+#endif
+}
+
 ccl_device_forceinline void guiding_record_direct_light(KernelGlobals kg,
                                                         IntegratorShadowState state)
 {
diff --git a/intern/cycles/kernel/integrator/shade_volume.h b/intern/cycles/kernel/integrator/shade_volume.h
index 94dbf4772cd..147d11091f7 100644
--- a/intern/cycles/kernel/integrator/shade_volume.h
+++ b/intern/cycles/kernel/integrator/shade_volume.h
@@ -613,6 +613,7 @@ ccl_device_forceinline void volume_integrate_heterogeneous(
           const Spectrum emission = volume_emission_integrate(
               &coeff, closure_flag, transmittance, dt);
           accum_emission += result.indirect_throughput * emission;
+          guiding_record_volume_emission(kg, state, emission);
         }
       }
 
@@ -665,7 +666,6 @@ ccl_device_forceinline void volume_integrate_heterogeneous(
 
   /* Write accumulated emission. */
   if (!is_zero(accum_emission)) {
-    /* TODO: record emission for path guiding? */
     film_write_volume_emission(
         kg, state, accum_emission, render_buffer, object_lightgroup(kg, sd->object));
   }



More information about the Bf-blender-cvs mailing list