Commit: f5d1551b6e29eebf0c9e1f0884e0b0571d358e34
Author: Sergey Sharybin
Date:   Sat Nov 28 19:43:54 2015 +0500
Branches: master
https://developer.blender.org/rBf5d1551b6e29eebf0c9e1f0884e0b0571d358e34

Cycles: Fix wrong original ray used for SSS baking

Also de-duplicated some code by moving to an utility function.

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

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

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

diff --git a/intern/cycles/kernel/kernel_bake.h 
b/intern/cycles/kernel/kernel_bake.h
index a04e759..c2845db 100644
--- a/intern/cycles/kernel/kernel_bake.h
+++ b/intern/cycles/kernel/kernel_bake.h
@@ -65,8 +65,8 @@ ccl_device void compute_light_pass(KernelGlobals *kg, 
ShaderData *sd, PathRadian
                if((is_combined || is_sss_sample) && (sd->flag & SD_BSSRDF)) {
                        /* when mixing BSSRDF and BSDF closures we should skip 
BSDF lighting if scattering was successful */
                        SubsurfaceIndirectRays ss_indirect;
-                       ss_indirect.tracing = false;
-                       ss_indirect.num_rays = 0;
+                       Ray orig_ray = ray;
+                       kernel_path_subsurface_init_indirect(&ss_indirect);
                        if(kernel_path_subsurface_scatter(kg,
                                                          sd,
                                                          &L_sample,
@@ -79,7 +79,7 @@ ccl_device void compute_light_pass(KernelGlobals *kg, 
ShaderData *sd, PathRadian
                                while(ss_indirect.num_rays) {
                                        
kernel_path_subsurface_setup_indirect(kg,
                                                                              
&ss_indirect,
-                                                                             
&ray,
+                                                                             
&orig_ray,
                                                                              
&state,
                                                                              
&ray,
                                                                              
&L_sample,
diff --git a/intern/cycles/kernel/kernel_path.h 
b/intern/cycles/kernel/kernel_path.h
index 721e0fc..baffdb5 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -522,6 +522,13 @@ ccl_device bool kernel_path_subsurface_scatter(
        return false;
 }
 
+ccl_device_inline void kernel_path_subsurface_init_indirect(
+        SubsurfaceIndirectRays *ss_indirect)
+{
+       ss_indirect->tracing = false;
+       ss_indirect->num_rays = 0;
+}
+
 ccl_device void kernel_path_subsurface_accum_indirect(
         SubsurfaceIndirectRays *ss_indirect,
         PathRadiance *L)
@@ -598,8 +605,7 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, 
RNG *rng, int sample,
 
 #ifdef __SUBSURFACE__
        SubsurfaceIndirectRays ss_indirect;
-       ss_indirect.tracing = false;
-       ss_indirect.num_rays = 0;
+       kernel_path_subsurface_init_indirect(&ss_indirect);
 
        /* TODO(sergey): Avoid having explicit copy of the pre-subsurface 
scatter
         * ray by storing an updated version of state in the ss_indirect which 
will

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to