diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-06 14:23:16 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-10-06 14:36:46 +0400 |
commit | 233de800e2db25ea4927e3734b66427ea43ee5c3 (patch) | |
tree | 874573a658a49a664041bcfeb09381db7fcd6e68 /intern | |
parent | b36eb51d37afd76745c7cebb371cf213ec376070 (diff) |
Cycles: Optimize of volume stack update when sampling SSS
basically we skip all non-volume objects now in the volume stack function.
Depending on the show it might give some percent of speedup.
Most of the speedup would be gained in the scenes when having SSS object
intersecting the volume and taking a reasonable amount of frame space.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index 56339be1ff9..d124ce4884e 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -375,8 +375,7 @@ ccl_device void kernel_path_subsurface_update_volume_stack(KernelGlobals *kg, Intersection isect; const float3 Pend = volume_ray.P + volume_ray.D*volume_ray.t; - while(scene_intersect(kg, &volume_ray, PATH_RAY_ALL_VISIBILITY, - &isect, NULL, 0.0f, 0.0f)) + while(scene_intersect_volume(kg, &volume_ray, &isect)) { ShaderData sd; shader_setup_from_ray(kg, &sd, &isect, &volume_ray, 0, 0); @@ -384,15 +383,7 @@ ccl_device void kernel_path_subsurface_update_volume_stack(KernelGlobals *kg, /* Move ray forward. */ volume_ray.P = ray_offset(sd.P, -sd.Ng); - volume_ray.D = normalize_len(Pend - volume_ray.P, - &volume_ray.t); - - /* TODO(sergey): Find a faster way detecting that ray_offset moved - * us pass through the end point. - */ - if(dot(ray->D, volume_ray.D) < 0.0f) { - break; - } + volume_ray.t -= sd.ray_length; } } #endif |