diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-11 17:45:55 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-04-11 18:18:14 +0300 |
commit | ac00c17900a22f77758dc0e65c8ab5f78f459528 (patch) | |
tree | 4efa99a46de1793809a2f77290ef12bd9eb1c6db /intern/cycles/kernel/geom | |
parent | e4cdda548a582b626f4a42bb702f166178a083e5 (diff) |
Cycles: Remove hair support from volume BVH traversal
There are couple of reasons:
- Volume shader on hair does behave really weird anyway and it's
not something considered a bug really.
- Volume BVH traversal were only used by camera-in-volume check,
which doesn't really make sense to take hair into account since
it'll be rendered wrong anyway.
Such a removal makes both code easier to extend further (as in,
no need to worry about those traversal for hair bvh) and also
reduces stress on GPU compilers.
Diffstat (limited to 'intern/cycles/kernel/geom')
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh.h | 51 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh_volume.h | 21 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_bvh_volume_all.h | 44 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_qbvh_volume.h | 21 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_qbvh_volume_all.h | 44 |
5 files changed, 0 insertions, 181 deletions
diff --git a/intern/cycles/kernel/geom/geom_bvh.h b/intern/cycles/kernel/geom/geom_bvh.h index f480af68c37..9eadc97386c 100644 --- a/intern/cycles/kernel/geom/geom_bvh.h +++ b/intern/cycles/kernel/geom/geom_bvh.h @@ -111,24 +111,12 @@ CCL_NAMESPACE_BEGIN # include "geom_bvh_volume.h" #endif -#if defined(__VOLUME__) && defined(__HAIR__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_hair -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH -# include "geom_bvh_volume.h" -#endif - #if defined(__VOLUME__) && defined(__OBJECT_MOTION__) # define BVH_FUNCTION_NAME bvh_intersect_volume_motion # define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION # include "geom_bvh_volume.h" #endif -#if defined(__VOLUME__) && defined(__HAIR__) && defined(__OBJECT_MOTION__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_hair_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION -# include "geom_bvh_volume.h" -#endif - /* Record all intersections - Shadow BVH traversal */ #if defined(__SHADOW_RECORD_ALL__) @@ -175,24 +163,12 @@ CCL_NAMESPACE_BEGIN # include "geom_bvh_volume_all.h" #endif -#if defined(__VOLUME_RECORD_ALL__) && defined(__HAIR__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_all_hair -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH -# include "geom_bvh_volume_all.h" -#endif - #if defined(__VOLUME_RECORD_ALL__) && defined(__OBJECT_MOTION__) # define BVH_FUNCTION_NAME bvh_intersect_volume_all_motion # define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_MOTION # include "geom_bvh_volume_all.h" #endif -#if defined(__VOLUME_RECORD_ALL__) && defined(__HAIR__) && defined(__OBJECT_MOTION__) -# define BVH_FUNCTION_NAME bvh_intersect_volume_all_hair_motion -# define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION -# include "geom_bvh_volume_all.h" -#endif - #undef BVH_FEATURE #undef BVH_NAME_JOIN #undef BVH_NAME_EVAL @@ -304,36 +280,21 @@ ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg, { # ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { -# ifdef __HAIR__ - if(kernel_data.bvh.have_curves) - return bvh_intersect_volume_hair_motion(kg, ray, isect, visibility); -# endif /* __HAIR__ */ - return bvh_intersect_volume_motion(kg, ray, isect, visibility); } # endif /* __OBJECT_MOTION__ */ - -# ifdef __HAIR__ - if(kernel_data.bvh.have_curves) - return bvh_intersect_volume_hair(kg, ray, isect, visibility); -# endif /* __HAIR__ */ - # ifdef __KERNEL_CPU__ - # ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) return bvh_intersect_volume_instancing(kg, ray, isect, visibility); # endif /* __INSTANCING__ */ - return bvh_intersect_volume(kg, ray, isect, visibility); # else /* __KERNEL_CPU__ */ - # ifdef __INSTANCING__ return bvh_intersect_volume_instancing(kg, ray, isect, visibility); # else return bvh_intersect_volume(kg, ray, isect, visibility); # endif /* __INSTANCING__ */ - # endif /* __KERNEL_CPU__ */ } #endif /* __VOLUME__ */ @@ -347,25 +308,13 @@ ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg, { # ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { -# ifdef __HAIR__ - if(kernel_data.bvh.have_curves) - return bvh_intersect_volume_all_hair_motion(kg, ray, isect, max_hits, visibility); -# endif /* __HAIR__ */ - return bvh_intersect_volume_all_motion(kg, ray, isect, max_hits, visibility); } # endif /* __OBJECT_MOTION__ */ - -# ifdef __HAIR__ - if(kernel_data.bvh.have_curves) - return bvh_intersect_volume_all_hair(kg, ray, isect, max_hits, visibility); -# endif /* __HAIR__ */ - # ifdef __INSTANCING__ if(kernel_data.bvh.have_instancing) return bvh_intersect_volume_all_instancing(kg, ray, isect, max_hits, visibility); # endif /* __INSTANCING__ */ - return bvh_intersect_volume_all(kg, ray, isect, max_hits, visibility); } #endif /* __VOLUME_RECORD_ALL__ */ diff --git a/intern/cycles/kernel/geom/geom_bvh_volume.h b/intern/cycles/kernel/geom/geom_bvh_volume.h index 14ab6e6891a..f3edf85d723 100644 --- a/intern/cycles/kernel/geom/geom_bvh_volume.h +++ b/intern/cycles/kernel/geom/geom_bvh_volume.h @@ -26,7 +26,6 @@ * versions for each case without new features slowing things down. * * BVH_INSTANCING: object instancing - * BVH_HAIR: hair curve rendering * BVH_MOTION: motion blur rendering * */ @@ -232,26 +231,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, break; } #endif -#if BVH_FEATURE(BVH_HAIR) - case PRIMITIVE_CURVE: - case PRIMITIVE_MOTION_CURVE: { - /* intersect ray against primitive */ - for(; primAddr < primAddr2; primAddr++) { - kernel_assert(kernel_tex_fetch(__prim_type, primAddr) == type); - /* only primitives from volume object */ - uint tri_object = (object == OBJECT_NONE)? kernel_tex_fetch(__prim_object, primAddr): object; - int object_flag = kernel_tex_fetch(__object_flag, tri_object); - if((object_flag & SD_OBJECT_HAS_VOLUME) == 0) { - continue; - } - if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) - bvh_cardinal_curve_intersect(kg, isect, P, dir, visibility, object, primAddr, ray->time, type, NULL, 0, 0); - else - bvh_curve_intersect(kg, isect, P, dir, visibility, object, primAddr, ray->time, type, NULL, 0, 0); - } - break; - } -#endif default: { break; } diff --git a/intern/cycles/kernel/geom/geom_bvh_volume_all.h b/intern/cycles/kernel/geom/geom_bvh_volume_all.h index b16eb3906e8..ec837212471 100644 --- a/intern/cycles/kernel/geom/geom_bvh_volume_all.h +++ b/intern/cycles/kernel/geom/geom_bvh_volume_all.h @@ -26,7 +26,6 @@ * versions for each case without new features slowing things down. * * BVH_INSTANCING: object instancing - * BVH_HAIR: hair curve rendering * BVH_MOTION: motion blur rendering * */ @@ -283,49 +282,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg, break; } #endif /* BVH_MOTION */ -#if BVH_FEATURE(BVH_HAIR) - case PRIMITIVE_CURVE: - case PRIMITIVE_MOTION_CURVE: { - /* intersect ray against primitive */ - for(; primAddr < primAddr2; primAddr++) { - kernel_assert(kernel_tex_fetch(__prim_type, primAddr) == type); - /* only primitives from volume object */ - uint tri_object = (object == OBJECT_NONE)? kernel_tex_fetch(__prim_object, primAddr): object; - int object_flag = kernel_tex_fetch(__object_flag, tri_object); - if((object_flag & SD_OBJECT_HAS_VOLUME) == 0) { - continue; - } - if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) - hit = bvh_cardinal_curve_intersect(kg, isect_array, P, dir, visibility, object, primAddr, ray->time, type, NULL, 0, 0); - else - hit = bvh_curve_intersect(kg, isect_array, P, dir, visibility, object, primAddr, ray->time, type, NULL, 0, 0); - if(hit) { - /* Move on to next entry in intersections array. */ - isect_array++; - num_hits++; -# if BVH_FEATURE(BVH_INSTANCING) - num_hits_in_instance++; -# endif - isect_array->t = isect_t; - if(num_hits == max_hits) { -# if BVH_FEATURE(BVH_INSTANCING) -# if BVH_FEATURE(BVH_MOTION) - float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -# else - Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); - float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -# endif - for(int i = 0; i < num_hits_in_instance; i++) { - (isect_array-i-1)->t *= t_fac; - } -# endif /* BVH_FEATURE(BVH_INSTANCING) */ - return num_hits; - } - } - } - break; - } -#endif /* BVH_HAIR */ default: { break; } diff --git a/intern/cycles/kernel/geom/geom_qbvh_volume.h b/intern/cycles/kernel/geom/geom_qbvh_volume.h index 36648fdd244..ab2e530dd20 100644 --- a/intern/cycles/kernel/geom/geom_qbvh_volume.h +++ b/intern/cycles/kernel/geom/geom_qbvh_volume.h @@ -22,7 +22,6 @@ * versions for each case without new features slowing things down. * * BVH_INSTANCING: object instancing - * BVH_HAIR: hair curve rendering * BVH_MOTION: motion blur rendering * */ @@ -249,26 +248,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, break; } #endif -#if BVH_FEATURE(BVH_HAIR) - case PRIMITIVE_CURVE: - case PRIMITIVE_MOTION_CURVE: { - for(; primAddr < primAddr2; primAddr++) { - kernel_assert(kernel_tex_fetch(__prim_type, primAddr) == type); - /* Only primitives from volume object. */ - uint tri_object = (object == OBJECT_NONE)? kernel_tex_fetch(__prim_object, primAddr): object; - int object_flag = kernel_tex_fetch(__object_flag, tri_object); - if((object_flag & SD_OBJECT_HAS_VOLUME) == 0) { - continue; - } - /* Intersect ray against primitive. */ - if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) - bvh_cardinal_curve_intersect(kg, isect, P, dir, visibility, object, primAddr, ray->time, type, NULL, 0, 0); - else - bvh_curve_intersect(kg, isect, P, dir, visibility, object, primAddr, ray->time, type, NULL, 0, 0); - } - break; - } -#endif } } #if BVH_FEATURE(BVH_INSTANCING) diff --git a/intern/cycles/kernel/geom/geom_qbvh_volume_all.h b/intern/cycles/kernel/geom/geom_qbvh_volume_all.h index 2cf78f2f00e..5546471b0e3 100644 --- a/intern/cycles/kernel/geom/geom_qbvh_volume_all.h +++ b/intern/cycles/kernel/geom/geom_qbvh_volume_all.h @@ -22,7 +22,6 @@ * versions for each case without new features slowing things down. * * BVH_INSTANCING: object instancing - * BVH_HAIR: hair curve rendering * BVH_MOTION: motion blur rendering * */ @@ -300,49 +299,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg, break; } #endif -#if BVH_FEATURE(BVH_HAIR) - case PRIMITIVE_CURVE: - case PRIMITIVE_MOTION_CURVE: { - for(; primAddr < primAddr2; primAddr++) { - kernel_assert(kernel_tex_fetch(__prim_type, primAddr) == type); - /* Only primitives from volume object. */ - uint tri_object = (object == OBJECT_NONE)? kernel_tex_fetch(__prim_object, primAddr): object; - int object_flag = kernel_tex_fetch(__object_flag, tri_object); - if((object_flag & SD_OBJECT_HAS_VOLUME) == 0) { - continue; - } - /* Intersect ray against primitive. */ - if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) - hit = bvh_cardinal_curve_intersect(kg, isect_array, P, dir, visibility, object, primAddr, ray->time, type, NULL, 0, 0); - else - hit = bvh_curve_intersect(kg, isect_array, P, dir, visibility, object, primAddr, ray->time, type, NULL, 0, 0); - if(hit) { - /* Move on to next entry in intersections array. */ - isect_array++; - num_hits++; -# if BVH_FEATURE(BVH_INSTANCING) - num_hits_in_instance++; -# endif - isect_array->t = isect_t; - if(num_hits == max_hits) { -# if BVH_FEATURE(BVH_INSTANCING) -# if BVH_FEATURE(BVH_MOTION) - float t_fac = 1.0f / len(transform_direction(&ob_itfm, dir)); -# else - Transform itfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); - float t_fac = 1.0f / len(transform_direction(&itfm, dir)); -# endif - for(int i = 0; i < num_hits_in_instance; i++) { - (isect_array-i-1)->t *= t_fac; - } -# endif /* BVH_FEATURE(BVH_INSTANCING) */ - return num_hits; - } - } - } - break; - } -#endif /* BVH_HAIR */ } } #if BVH_FEATURE(BVH_INSTANCING) |