[Bf-blender-cvs] [233de80] master: Cycles: Optimize of volume stack update when sampling SSS

Sergey Sharybin noreply at git.blender.org
Mon Oct 6 12:39:25 CEST 2014


Commit: 233de800e2db25ea4927e3734b66427ea43ee5c3
Author: Sergey Sharybin
Date:   Mon Oct 6 12:23:16 2014 +0200
Branches: master
https://developer.blender.org/rB233de800e2db25ea4927e3734b66427ea43ee5c3

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.

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

M	intern/cycles/kernel/kernel_path.h

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

diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 56339be..d124ce4 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




More information about the Bf-blender-cvs mailing list