diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-03 12:52:04 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-03 12:52:04 +0400 |
commit | a65451235637514abaaf2b04c5a89f14a6edd96f (patch) | |
tree | 434aa96d50837b2a08992230ddb46f9ab1995be4 /intern/cycles/kernel/kernel_path.h | |
parent | b86f199a98fe77b634ea7f686d3d664d9791562b (diff) |
Cycles: Implement preliminary test for volume stack update from SSS
This adds an AABB collision check for objects with volumes and if there's a
collision detected then the object will have SD_OBJECT_INTERSECTS_VOLUME flag.
This solves a speed regression introduced by the fix for T39823 by skipping
volume stack update in cases no volumes intersects the current SSS object.
Diffstat (limited to 'intern/cycles/kernel/kernel_path.h')
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 29077a8886c..e68a8370012 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -411,6 +411,8 @@ ccl_device bool kernel_path_subsurface_scatter(KernelGlobals *kg, ShaderData *sd int num_hits = subsurface_scatter_multi_step(kg, sd, bssrdf_sd, state->flag, sc, &lcg_state, bssrdf_u, bssrdf_v, false); #ifdef __VOLUME__ Ray volume_ray = *ray; + bool need_update_volume_stack = kernel_data.integrator.use_volumes && + sd->flag & SD_OBJECT_INTERSECTS_VOLUME; #endif /* compute lighting with the BSDF closure */ @@ -430,7 +432,7 @@ ccl_device bool kernel_path_subsurface_scatter(KernelGlobals *kg, ShaderData *sd #endif #ifdef __VOLUME__ - if(kernel_data.integrator.use_volumes) { + if(need_update_volume_stack) { /* Setup ray from previous surface point to the new one. */ volume_ray.D = normalize_len(hit_ray.P - volume_ray.P, &volume_ray.t); @@ -802,6 +804,8 @@ ccl_device void kernel_branched_path_subsurface_scatter(KernelGlobals *kg, int num_hits = subsurface_scatter_multi_step(kg, sd, bssrdf_sd, state->flag, sc, &lcg_state, bssrdf_u, bssrdf_v, true); #ifdef __VOLUME__ Ray volume_ray = *ray; + bool need_update_volume_stack = kernel_data.integrator.use_volumes && + sd->flag & SD_OBJECT_INTERSECTS_VOLUME; #endif /* compute lighting with the BSDF closure */ @@ -811,7 +815,7 @@ ccl_device void kernel_branched_path_subsurface_scatter(KernelGlobals *kg, path_state_branch(&hit_state, j, num_samples); #ifdef __VOLUME__ - if(kernel_data.integrator.use_volumes) { + if(need_update_volume_stack) { /* Setup ray from previous surface point to the new one. */ float3 P = ray_offset(bssrdf_sd[hit].P, -bssrdf_sd[hit].Ng); volume_ray.D = normalize_len(P - volume_ray.P, |