diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-04-30 16:49:26 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2012-04-30 16:49:26 +0400 |
commit | 1d8c79818870b92df46c443d7778438aa67d019c (patch) | |
tree | ba3fc305671261e40851d8a230a33ebe19396e95 /intern/cycles/kernel/kernel_bvh.h | |
parent | 796dd8a321108df26757fb9df5c2aa6eb42c9633 (diff) |
Cycles: support for motion vector and UV passes.
Most of the changes are related to adding support for motion data throughout
the code. There's some code for actual camera/object motion blur raytracing
but it's unfinished (it badly slows down the raytracing kernel even when the
option is turned off), so that code it disabled still.
Motion vector export from Blender tries to avoid computing derived meshes
when the mesh does not have a deforming modifier, and it also won't store
motion vectors for every vertex if only the object or camera is moving.
Diffstat (limited to 'intern/cycles/kernel/kernel_bvh.h')
-rw-r--r-- | intern/cycles/kernel/kernel_bvh.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h index 523ae8ae926..5da4253bd86 100644 --- a/intern/cycles/kernel/kernel_bvh.h +++ b/intern/cycles/kernel/kernel_bvh.h @@ -57,7 +57,7 @@ __device_inline float3 bvh_inverse_direction(float3 dir) __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, const float tmax) { - Transform tfm = object_fetch_transform(kg, object, OBJECT_INVERSE_TRANSFORM); + Transform tfm = object_fetch_transform(kg, object, ray->time, OBJECT_INVERSE_TRANSFORM); *P = transform_point(&tfm, ray->P); @@ -74,7 +74,7 @@ __device_inline void bvh_instance_push(KernelGlobals *kg, int object, const Ray __device_inline void bvh_instance_pop(KernelGlobals *kg, int object, const Ray *ray, float3 *P, float3 *idir, float *t, const float tmax) { - Transform tfm = object_fetch_transform(kg, object, OBJECT_TRANSFORM); + Transform tfm = object_fetch_transform(kg, object, ray->time, OBJECT_TRANSFORM); if(*t != FLT_MAX) *t *= len(transform_direction(&tfm, 1.0f/(*idir))); @@ -341,7 +341,7 @@ __device_inline float3 ray_offset(float3 P, float3 Ng) #endif } -__device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection *isect, const Ray *ray) +__device_inline float3 bvh_triangle_refine(KernelGlobals *kg, ShaderData *sd, const Intersection *isect, const Ray *ray) { float3 P = ray->P; float3 D = ray->D; @@ -349,7 +349,11 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection #ifdef __INTERSECTION_REFINE__ if(isect->object != ~0) { - Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_INVERSE_TRANSFORM); +#ifdef __MOTION__ + Transform tfm = sd->ob_itfm; +#else + Transform tfm = object_fetch_transform(kg, isect->object, ray->time, OBJECT_INVERSE_TRANSFORM); +#endif P = transform_point(&tfm, P); D = transform_direction(&tfm, D*t); @@ -366,7 +370,12 @@ __device_inline float3 bvh_triangle_refine(KernelGlobals *kg, const Intersection P = P + D*rt; if(isect->object != ~0) { - Transform tfm = object_fetch_transform(kg, isect->object, OBJECT_TRANSFORM); +#ifdef __MOTION__ + Transform tfm = sd->ob_tfm; +#else + Transform tfm = object_fetch_transform(kg, isect->object, ray->time, OBJECT_TRANSFORM); +#endif + P = transform_point(&tfm, P); } |