Cycles: Fix wrong intersection with motion blur and degenerate object transform
This commit is contained in:
parent
4974ed93ef
commit
29247a7a05
|
@ -59,7 +59,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
float isect_t = tmax;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
|
@ -302,7 +302,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
object = kernel_tex_fetch(__prim_object, -primAddr-1);
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t);
|
||||
#endif
|
||||
|
@ -338,7 +338,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
float t_fac;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_tfm);
|
||||
bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac);
|
||||
#endif
|
||||
|
@ -353,7 +353,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
float ignore_t = FLT_MAX;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t);
|
||||
#endif
|
||||
|
|
|
@ -63,7 +63,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
uint num_hits = 0;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
#if defined(__KERNEL_SSE2__)
|
||||
|
@ -240,7 +240,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
object = subsurface_object;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t);
|
||||
#endif
|
||||
|
@ -278,7 +278,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
|
||||
/* instance pop */
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect_t);
|
||||
#endif
|
||||
|
|
|
@ -65,7 +65,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
int object = OBJECT_NONE;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
isect->t = ray->t;
|
||||
|
@ -342,7 +342,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
object = kernel_tex_fetch(__prim_object, -primAddr-1);
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect->t);
|
||||
#endif
|
||||
|
@ -378,7 +378,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
|
||||
/* instance pop */
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect->t);
|
||||
#endif
|
||||
|
|
|
@ -59,7 +59,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
const uint visibility = PATH_RAY_ALL_VISIBILITY;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
isect->t = ray->t;
|
||||
|
@ -267,7 +267,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
if(object_flag & SD_OBJECT_HAS_VOLUME) {
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect->t);
|
||||
#endif
|
||||
|
@ -307,7 +307,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
|
||||
/* instance pop */
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect->t);
|
||||
#endif
|
||||
|
|
|
@ -62,7 +62,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
const uint visibility = PATH_RAY_ALL_VISIBILITY;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
|
@ -230,7 +230,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
if(num_hits == max_hits) {
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
float t_fac = len(transform_direction(&ob_tfm, 1.0f/idir));
|
||||
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));
|
||||
|
@ -268,7 +268,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
if(num_hits == max_hits) {
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
# if BVH_FEATURE(BVH_MOTION)
|
||||
float t_fac = len(transform_direction(&ob_tfm, 1.0f/idir));
|
||||
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));
|
||||
|
@ -311,7 +311,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
if(num_hits == max_hits) {
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
# if BVH_FEATURE(BVH_MOTION)
|
||||
float t_fac = len(transform_direction(&ob_tfm, 1.0f/idir));
|
||||
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));
|
||||
|
@ -341,7 +341,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
if(object_flag & SD_OBJECT_HAS_VOLUME) {
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t);
|
||||
#endif
|
||||
|
@ -384,7 +384,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
if(num_hits_in_instance) {
|
||||
float t_fac;
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_tfm);
|
||||
bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac);
|
||||
#endif
|
||||
|
@ -397,7 +397,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||
else {
|
||||
float ignore_t = FLT_MAX;
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t);
|
||||
#endif
|
||||
|
|
|
@ -453,15 +453,21 @@ ccl_device_inline void bvh_instance_pop_factor(KernelGlobals *kg, int object, co
|
|||
#ifdef __OBJECT_MOTION__
|
||||
/* Transform ray into object space to enter motion blurred object in BVH */
|
||||
|
||||
ccl_device_inline void bvh_instance_motion_push(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *dir, float3 *idir, ccl_addr_space float *t, Transform *tfm)
|
||||
ccl_device_inline void bvh_instance_motion_push(KernelGlobals *kg,
|
||||
int object,
|
||||
const Ray *ray,
|
||||
float3 *P,
|
||||
float3 *dir,
|
||||
float3 *idir,
|
||||
ccl_addr_space float *t,
|
||||
Transform *itfm)
|
||||
{
|
||||
Transform itfm;
|
||||
*tfm = object_fetch_transform_motion_test(kg, object, ray->time, &itfm);
|
||||
object_fetch_transform_motion_test(kg, object, ray->time, itfm);
|
||||
|
||||
*P = transform_point(&itfm, ray->P);
|
||||
*P = transform_point(itfm, ray->P);
|
||||
|
||||
float len;
|
||||
*dir = bvh_clamp_direction(normalize_len(transform_direction(&itfm, ray->D), &len));
|
||||
*dir = bvh_clamp_direction(normalize_len(transform_direction(itfm, ray->D), &len));
|
||||
*idir = bvh_inverse_direction(*dir);
|
||||
|
||||
if(*t != FLT_MAX)
|
||||
|
@ -475,18 +481,24 @@ ccl_device_inline void bvh_instance_motion_push(KernelGlobals *kg, int object, c
|
|||
* TODO(sergey): Investigate if passing NULL instead of t1 gets optimized
|
||||
* so we can avoid having this duplication.
|
||||
*/
|
||||
ccl_device_inline void qbvh_instance_motion_push(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *dir, float3 *idir, float *t, float *t1, Transform *tfm)
|
||||
ccl_device_inline void qbvh_instance_motion_push(KernelGlobals *kg,
|
||||
int object,
|
||||
const Ray *ray,
|
||||
float3 *P,
|
||||
float3 *dir,
|
||||
float3 *idir,
|
||||
float *t,
|
||||
float *t1,
|
||||
Transform *itfm)
|
||||
{
|
||||
Transform itfm;
|
||||
*tfm = object_fetch_transform_motion_test(kg, object, ray->time, &itfm);
|
||||
object_fetch_transform_motion_test(kg, object, ray->time, itfm);
|
||||
|
||||
*P = transform_point(&itfm, ray->P);
|
||||
*P = transform_point(itfm, ray->P);
|
||||
|
||||
float len;
|
||||
*dir = bvh_clamp_direction(normalize_len(transform_direction(&itfm, ray->D), &len));
|
||||
*dir = bvh_clamp_direction(normalize_len(transform_direction(itfm, ray->D), &len));
|
||||
*idir = bvh_inverse_direction(*dir);
|
||||
|
||||
|
||||
if(*t != FLT_MAX)
|
||||
*t *= len;
|
||||
|
||||
|
@ -497,10 +509,18 @@ ccl_device_inline void qbvh_instance_motion_push(KernelGlobals *kg, int object,
|
|||
|
||||
/* Transorm ray to exit motion blurred object in BVH */
|
||||
|
||||
ccl_device_inline void bvh_instance_motion_pop(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *dir, float3 *idir, ccl_addr_space float *t, Transform *tfm)
|
||||
ccl_device_inline void bvh_instance_motion_pop(KernelGlobals *kg,
|
||||
int object,
|
||||
const Ray *ray,
|
||||
float3 *P,
|
||||
float3 *dir,
|
||||
float3 *idir,
|
||||
ccl_addr_space float *t,
|
||||
Transform *itfm)
|
||||
{
|
||||
if(*t != FLT_MAX)
|
||||
*t *= len(transform_direction(tfm, 1.0f/(*idir)));
|
||||
if(*t != FLT_MAX) {
|
||||
*t /= len(transform_direction(itfm, ray->D));
|
||||
}
|
||||
|
||||
*P = ray->P;
|
||||
*dir = bvh_clamp_direction(ray->D);
|
||||
|
@ -509,10 +529,16 @@ ccl_device_inline void bvh_instance_motion_pop(KernelGlobals *kg, int object, co
|
|||
|
||||
/* Same as above, but returns scale factor to apply to multiple intersection distances */
|
||||
|
||||
ccl_device_inline void bvh_instance_motion_pop_factor(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *dir, float3 *idir, float *t_fac, Transform *tfm)
|
||||
ccl_device_inline void bvh_instance_motion_pop_factor(KernelGlobals *kg,
|
||||
int object,
|
||||
const Ray *ray,
|
||||
float3 *P,
|
||||
float3 *dir,
|
||||
float3 *idir,
|
||||
float *t_fac,
|
||||
Transform *itfm)
|
||||
{
|
||||
*t_fac = len(transform_direction(tfm, 1.0f/(*idir)));
|
||||
|
||||
*t_fac /= len(transform_direction(itfm, ray->D));
|
||||
*P = ray->P;
|
||||
*dir = bvh_clamp_direction(ray->D);
|
||||
*idir = bvh_inverse_direction(*dir);
|
||||
|
|
|
@ -55,7 +55,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
float isect_t = tmax;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
*num_hits = 0;
|
||||
|
@ -317,7 +317,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
object = kernel_tex_fetch(__prim_object, -primAddr-1);
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t);
|
||||
#endif
|
||||
|
@ -357,7 +357,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
float t_fac;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_tfm);
|
||||
bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac);
|
||||
#endif
|
||||
|
@ -370,7 +370,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
float ignore_t = FLT_MAX;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t);
|
||||
#endif
|
||||
|
|
|
@ -58,7 +58,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
uint num_hits = 0;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL_SSE41__
|
||||
|
@ -256,7 +256,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
object = subsurface_object;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t);
|
||||
#endif
|
||||
|
@ -297,7 +297,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
|
||||
/* Instance pop. */
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect_t);
|
||||
#endif
|
||||
|
|
|
@ -63,7 +63,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
int object = OBJECT_NONE;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL_SSE41__
|
||||
|
@ -356,7 +356,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
object = kernel_tex_fetch(__prim_object, -primAddr-1);
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
qbvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &nodeDist, &ob_tfm);
|
||||
qbvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &nodeDist, &ob_itfm);
|
||||
#else
|
||||
qbvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect->t, &nodeDist);
|
||||
#endif
|
||||
|
@ -395,7 +395,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
|
||||
/* Instance pop. */
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect->t);
|
||||
#endif
|
||||
|
|
|
@ -54,7 +54,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
const uint visibility = PATH_RAY_ALL_VISIBILITY;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL_SSE41__
|
||||
|
@ -281,7 +281,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
if(object_flag & SD_OBJECT_HAS_VOLUME) {
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect->t);
|
||||
#endif
|
||||
|
@ -322,7 +322,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
|
||||
/* Instance pop. */
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &isect->t);
|
||||
#endif
|
||||
|
|
|
@ -57,7 +57,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
const uint visibility = PATH_RAY_ALL_VISIBILITY;
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
Transform ob_tfm;
|
||||
Transform ob_itfm;
|
||||
#endif
|
||||
|
||||
uint num_hits = 0;
|
||||
|
@ -247,7 +247,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
if(num_hits == max_hits) {
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
float t_fac = len(transform_direction(&ob_tfm, 1.0f/idir));
|
||||
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));
|
||||
|
@ -285,7 +285,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
if(num_hits == max_hits) {
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
# if BVH_FEATURE(BVH_MOTION)
|
||||
float t_fac = len(transform_direction(&ob_tfm, 1.0f/idir));
|
||||
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));
|
||||
|
@ -328,7 +328,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
if(num_hits == max_hits) {
|
||||
#if BVH_FEATURE(BVH_INSTANCING)
|
||||
# if BVH_FEATURE(BVH_MOTION)
|
||||
float t_fac = len(transform_direction(&ob_tfm, 1.0f/idir));
|
||||
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));
|
||||
|
@ -355,7 +355,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
if(object_flag & SD_OBJECT_HAS_VOLUME) {
|
||||
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm);
|
||||
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t);
|
||||
#endif
|
||||
|
@ -400,7 +400,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
if(num_hits_in_instance) {
|
||||
float t_fac;
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_tfm);
|
||||
bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac);
|
||||
#endif
|
||||
|
@ -413,7 +413,7 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||
else {
|
||||
float ignore_t = FLT_MAX;
|
||||
#if BVH_FEATURE(BVH_MOTION)
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_tfm);
|
||||
bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_itfm);
|
||||
#else
|
||||
bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue