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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2014-04-19 19:02:30 +0400
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2014-04-21 21:34:25 +0400
commit9ab259f55b67c6e3b8028d95b23e708c3bc0c6fd (patch)
treeffaba2fef52cf1066bbf875a4a5391ad0879c3ff /intern/cycles/kernel/geom/geom_bvh_subsurface.h
parentf6abc96b6b3ee53e100263e93de2e4323cd7231e (diff)
Cycles: shadow function optimization for transparent shadows (CPU only).
Old algorithm: Raytrace from one transparent surface to the next step by step. To minimize overhead in cases where we don't need transparent shadows, we first trace a regular shadow ray. We check if the hit primitive was potentially transparent, and only in that case start marching. this gives extra ray cast for the cases were we do want transparency. New algorithm: We trace a single ray. If it hits any opaque surface, or more than a given number of transparent surfaces is hit, then we consider the geometry to be entirely blocked. If not, all transparent surfaces will be recorded and we will shade them one by one to determine how much light is blocked. This all happens in one scene intersection function. Recording all hits works well in some cases but may be slower in others. If we have many semi-transparent hairs, one intersection may be faster because you'd be reinteresecting the same hairs a lot with each step otherwise. If however there is mostly binary transparency then we may be recording many unnecessary intersections when one of the first surfaces blocks all light. We found that this helps quite nicely in some scenes, on koro.blend this can give a 50% reduction in render time, on the pabellon barcelona scene and a forest scene with transparent leaves it was 30%. Some other files rendered maybe 1% or 2% slower, but this seems a reasonable tradeoff. Differential Revision: https://developer.blender.org/D473
Diffstat (limited to 'intern/cycles/kernel/geom/geom_bvh_subsurface.h')
-rw-r--r--intern/cycles/kernel/geom/geom_bvh_subsurface.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/intern/cycles/kernel/geom/geom_bvh_subsurface.h b/intern/cycles/kernel/geom/geom_bvh_subsurface.h
index 6b71ffc24ba..30fc3d68feb 100644
--- a/intern/cycles/kernel/geom/geom_bvh_subsurface.h
+++ b/intern/cycles/kernel/geom/geom_bvh_subsurface.h
@@ -48,12 +48,11 @@ ccl_device uint BVH_FUNCTION_NAME(KernelGlobals *kg, const Ray *ray, Intersectio
int nodeAddr = kernel_data.bvh.root;
/* ray parameters in registers */
- const float tmax = ray->t;
float3 P = ray->P;
float3 dir = bvh_clamp_direction(ray->D);
float3 idir = bvh_inverse_direction(dir);
int object = OBJECT_NONE;
- float isect_t = tmax;
+ float isect_t = ray->t;
const uint visibility = PATH_RAY_ALL_VISIBILITY;
uint num_hits = 0;
@@ -236,9 +235,9 @@ ccl_device uint BVH_FUNCTION_NAME(KernelGlobals *kg, const Ray *ray, Intersectio
object = subsurface_object;
#if FEATURE(BVH_MOTION)
- bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm, tmax);
+ bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
#else
- bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t, tmax);
+ bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t);
#endif
#if defined(__KERNEL_SSE2__)
@@ -272,9 +271,9 @@ ccl_device uint BVH_FUNCTION_NAME(KernelGlobals *kg, const Ray *ray, Intersectio
/* instance pop */
#if FEATURE(BVH_MOTION)
- bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm, tmax);
+ bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
#else
- bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect_t, tmax);
+ bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect_t);
#endif
#if defined(__KERNEL_SSE2__)