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 18:06:44 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-11-28 18:07:34 +0300
commit6147c4037d288c7032c8dd63d6c448a9cebcc117 (patch)
treedeaa6a2fae60c11ae3d9abe39337b80fe9f33746 /intern
parentf5d1551b6e29eebf0c9e1f0884e0b0571d358e34 (diff)
Cycles: Fix wrong volume stack after SSS bounce
Was introduced by a recent fixes, now it should be all correct and additionally it solves the TODO mentioned in the code.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/kernel_bake.h2
-rw-r--r--intern/cycles/kernel/kernel_path.h37
2 files changed, 14 insertions, 25 deletions
diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h
index c2845db8b57..715c11c7ea0 100644
--- a/intern/cycles/kernel/kernel_bake.h
+++ b/intern/cycles/kernel/kernel_bake.h
@@ -65,7 +65,6 @@ 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;
- Ray orig_ray = ray;
kernel_path_subsurface_init_indirect(&ss_indirect);
if(kernel_path_subsurface_scatter(kg,
sd,
@@ -79,7 +78,6 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian
while(ss_indirect.num_rays) {
kernel_path_subsurface_setup_indirect(kg,
&ss_indirect,
- &orig_ray,
&state,
&ray,
&L_sample,
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index baffdb50e8e..72c0f7a3c7b 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -511,6 +511,20 @@ ccl_device bool kernel_path_subsurface_scatter(
hit_state->ray_t = 0.0f;
#endif
+#ifdef __VOLUME__
+ if(ss_indirect->need_update_volume_stack) {
+ Ray volume_ray = *ray;
+ /* Setup ray from previous surface point to the new one. */
+ volume_ray.D = normalize_len(hit_ray->P - volume_ray.P,
+ &volume_ray.t);
+
+ kernel_volume_stack_update_for_subsurface(
+ kg,
+ &volume_ray,
+ hit_state->volume_stack);
+ }
+#endif
+
ss_indirect->num_rays++;
}
else {
@@ -545,7 +559,6 @@ ccl_device void kernel_path_subsurface_accum_indirect(
ccl_device void kernel_path_subsurface_setup_indirect(
KernelGlobals *kg,
SubsurfaceIndirectRays *ss_indirect,
- const Ray *orig_ray,
PathState *state,
Ray *ray,
PathRadiance *L,
@@ -562,20 +575,6 @@ ccl_device void kernel_path_subsurface_setup_indirect(
Ray *indirect_ray = &ss_indirect->rays[ss_indirect->num_rays];
PathRadiance *indirect_L = &ss_indirect->L[ss_indirect->num_rays];
-#ifdef __VOLUME__
- if(ss_indirect->need_update_volume_stack) {
- Ray volume_ray = *orig_ray;
-
- /* Setup ray from previous surface point to the new one. */
- volume_ray.D = normalize_len(indirect_ray->P - volume_ray.P,
- &volume_ray.t);
-
- kernel_volume_stack_update_for_subsurface(kg,
- &volume_ray,
- state->volume_stack);
- }
-#endif /* __VOLUME__ */
-
*state = ss_indirect->state[ss_indirect->num_rays];
*ray = *indirect_ray;
*L = *indirect_L;
@@ -607,12 +606,6 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
SubsurfaceIndirectRays ss_indirect;
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
- * be updated to the new volume stack.
- */
- Ray ss_orig_ray;
-
for(;;) {
#endif
@@ -862,7 +855,6 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
&throughput,
&ss_indirect))
{
- ss_orig_ray = ray;
break;
}
}
@@ -885,7 +877,6 @@ ccl_device float4 kernel_path_integrate(KernelGlobals *kg, RNG *rng, int sample,
if(ss_indirect.num_rays) {
kernel_path_subsurface_setup_indirect(kg,
&ss_indirect,
- &ss_orig_ray,
&state,
&ray,
&L,