Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-11-28 17:43:54 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-11-28 18:07:34 +0300
commitf5d1551b6e29eebf0c9e1f0884e0b0571d358e34 (patch)
tree4132b899a7b8d2c4e543b9f1e0631fdcf3aaa4a4 /intern
parent1e43f0d74216cc936e6a708be321ba2c05b66ca1 (diff)
Cycles: Fix wrong original ray used for SSS baking
Also de-duplicated some code by moving to an utility function.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/kernel_bake.h6
-rw-r--r--intern/cycles/kernel/kernel_path.h10
2 files changed, 11 insertions, 5 deletions
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h
index a04e759f6eb..c2845db8b57 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 721e0fc32d5..baffdb50e8e 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