[Bf-blender-cvs] [6331385a503] soc-2020-production-ready-light-tree: Fixed how last not-transparent bounce is found. Was using emission_sd if most recent bounce was transparent, but this is incorrect. Now it uses the ray_N PathState for normal and recalculates the point.

Sam Kottler noreply at git.blender.org
Fri Jun 19 20:17:34 CEST 2020


Commit: 6331385a503664c0da1d22d260e274b931865590
Author: Sam Kottler
Date:   Fri Jun 19 12:14:00 2020 -0600
Branches: soc-2020-production-ready-light-tree
https://developer.blender.org/rB6331385a503664c0da1d22d260e274b931865590

Fixed how last not-transparent bounce is found.
Was using emission_sd if most recent bounce was transparent, but this
is incorrect. Now it uses the ray_N PathState for normal and
recalculates the point.

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

M	intern/cycles/kernel/kernel_emission.h
M	intern/cycles/kernel/kernel_path.h

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

diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h
index 5e04f52a22c..46ff209e6f1 100644
--- a/intern/cycles/kernel/kernel_emission.h
+++ b/intern/cycles/kernel/kernel_emission.h
@@ -349,14 +349,8 @@ ccl_device_noinline_cpu float3 indirect_background(KernelGlobals *kg,
   /* consider shading point at previous non-transparent bounce */
   float3 P_pick;
   float3 N_pick;
-  if (state->ray_t == 0.0f) {  // Non-transparent bounce
-    P_pick = emission_sd->P_pick;
-    N_pick = emission_sd->N_pick;
-  }
-  else {  // Transparent bounce
-    P_pick = ray->P - state->ray_t * ray->D;
-    N_pick = state->ray_N;
-  }
+  P_pick = ray->P - state->ray_t * ray->D;
+  N_pick = state->ray_N;
 
   /* check if background light exists or if we should skip pdf */
   int res_x = kernel_data.integrator.pdf_background_res_x;
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index af9833385b4..84ccb48bdf9 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -98,15 +98,8 @@ ccl_device_forceinline void kernel_path_lamp_emission(KernelGlobals *kg,
     /* ray starting from previous non-transparent bounce */
     Ray light_ray ccl_optional_struct_init;
     float3 N_pick;
-    if (state->ray_t == 0.0f) {
-      light_ray.P = emission_sd->P_pick;
-      N_pick = emission_sd->N_pick;
-    }
-    else {
-      /* Current bounce was on a transparent surface */
-      light_ray.P = ray->P - state->ray_t * ray->D;
-      N_pick = state->ray_N;
-    }
+    light_ray.P = ray->P - state->ray_t * ray->D;
+    N_pick = state->ray_N;
 
     state->ray_t += isect->t;
     light_ray.D = ray->D;
@@ -337,14 +330,8 @@ ccl_device_forceinline bool kernel_path_shader_apply(KernelGlobals *kg,
     /* ray starting from previous non-transparent bounce */
     float3 P_pick;
     float3 N_pick;
-    if (state->ray_t == 0.0f) {  // Non-transparent bounce
-      P_pick = sd->P_pick;
-      N_pick = sd->N_pick;
-    }
-    else {  // Transparent bounce
-      P_pick = ray->P - state->ray_t * ray->D;
-      N_pick = state->ray_N;
-    }
+    P_pick = ray->P - state->ray_t * ray->D;
+    N_pick = state->ray_N;
 
     float ray_length = state->ray_t + sd->ray_length;



More information about the Bf-blender-cvs mailing list