[Bf-blender-cvs] [b1ba476c133] cycles-x: Cycles X: put diffuse transmission into diffuse passes again

Brecht Van Lommel noreply at git.blender.org
Wed Sep 1 20:02:34 CEST 2021


Commit: b1ba476c133f161e7e627ea8d5f8d6af1b2c74fe
Author: Brecht Van Lommel
Date:   Wed Sep 1 19:55:19 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBb1ba476c133f161e7e627ea8d5f8d6af1b2c74fe

Cycles X: put diffuse transmission into diffuse passes again

I thought this would require additional memory, but with the latest code it's
actually not needed.

Fixes T91055

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

M	intern/cycles/kernel/kernel_accumulate.h

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

diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index b7e840ecd28..35e87d4fbf2 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -342,11 +342,15 @@ ccl_device_inline void kernel_accum_emission_or_background_pass(INTEGRATOR_STATE
     /* Directly visible, write to emission or background pass. */
     pass_offset = pass;
   }
-  else if (path_flag & PATH_RAY_REFLECT_PASS) {
+  else if (path_flag & (PATH_RAY_REFLECT_PASS | PATH_RAY_TRANSMISSION_PASS)) {
     /* Indirectly visible through reflection. */
-    const int glossy_pass_offset = pass_offset = (INTEGRATOR_STATE(path, bounce) == 1) ?
-                                                     kernel_data.film.pass_glossy_direct :
-                                                     kernel_data.film.pass_glossy_indirect;
+    const int glossy_pass_offset = (path_flag & PATH_RAY_REFLECT_PASS) ?
+                                       ((INTEGRATOR_STATE(path, bounce) == 1) ?
+                                            kernel_data.film.pass_glossy_direct :
+                                            kernel_data.film.pass_glossy_indirect) :
+                                       ((INTEGRATOR_STATE(path, bounce) == 1) ?
+                                            kernel_data.film.pass_transmission_direct :
+                                            kernel_data.film.pass_transmission_indirect);
 
     if (glossy_pass_offset != PASS_UNUSED) {
       /* Glossy is a subset of the throughput, reconstruct it here using the
@@ -363,12 +367,6 @@ ccl_device_inline void kernel_accum_emission_or_background_pass(INTEGRATOR_STATE
       contribution *= INTEGRATOR_STATE(path, diffuse_glossy_ratio);
     }
   }
-  else if (path_flag & PATH_RAY_TRANSMISSION_PASS) {
-    /* Indirectly visible through transmission. */
-    pass_offset = (INTEGRATOR_STATE(path, bounce) == 1) ?
-                      kernel_data.film.pass_transmission_direct :
-                      kernel_data.film.pass_transmission_indirect;
-  }
   else if (path_flag & PATH_RAY_VOLUME_PASS) {
     /* Indirectly visible through volume. */
     pass_offset = (INTEGRATOR_STATE(path, bounce) == 1) ? kernel_data.film.pass_volume_direct :
@@ -400,11 +398,15 @@ ccl_device_inline void kernel_accum_light(INTEGRATOR_STATE_CONST_ARGS,
     const int path_flag = INTEGRATOR_STATE(shadow_path, flag);
     int pass_offset = PASS_UNUSED;
 
-    if (path_flag & PATH_RAY_REFLECT_PASS) {
+    if (path_flag & (PATH_RAY_REFLECT_PASS | PATH_RAY_TRANSMISSION_PASS)) {
       /* Indirectly visible through reflection. */
-      const int glossy_pass_offset = pass_offset = (INTEGRATOR_STATE(shadow_path, bounce) == 0) ?
-                                                       kernel_data.film.pass_glossy_direct :
-                                                       kernel_data.film.pass_glossy_indirect;
+      const int glossy_pass_offset = (path_flag & PATH_RAY_REFLECT_PASS) ?
+                                         ((INTEGRATOR_STATE(shadow_path, bounce) == 1) ?
+                                              kernel_data.film.pass_glossy_direct :
+                                              kernel_data.film.pass_glossy_indirect) :
+                                         ((INTEGRATOR_STATE(shadow_path, bounce) == 1) ?
+                                              kernel_data.film.pass_transmission_direct :
+                                              kernel_data.film.pass_transmission_indirect);
 
       if (glossy_pass_offset != PASS_UNUSED) {
         /* Glossy is a subset of the throughput, reconstruct it here using the
@@ -422,12 +424,6 @@ ccl_device_inline void kernel_accum_light(INTEGRATOR_STATE_CONST_ARGS,
         contribution *= INTEGRATOR_STATE(shadow_path, diffuse_glossy_ratio);
       }
     }
-    else if (path_flag & PATH_RAY_TRANSMISSION_PASS) {
-      /* Indirectly visible through transmission. */
-      pass_offset = (INTEGRATOR_STATE(shadow_path, bounce) == 0) ?
-                        kernel_data.film.pass_transmission_direct :
-                        kernel_data.film.pass_transmission_indirect;
-    }
     else if (path_flag & PATH_RAY_VOLUME_PASS) {
       /* Indirectly visible through volume. */
       pass_offset = (INTEGRATOR_STATE(shadow_path, bounce) == 0) ?



More information about the Bf-blender-cvs mailing list