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_camera.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_camera.h')
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 99dac18d545..7b93ed7c0e6 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -63,6 +63,11 @@ __device void camera_sample_perspective(KernelGlobals *kg, float raster_x, float /* transform ray from camera to world */ Transform cameratoworld = kernel_data.cam.cameratoworld; +#ifdef __MOTION__ + if(ray->time != TIME_INVALID) + transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time); +#endif + ray->P = transform_point(&cameratoworld, ray->P); ray->D = transform_direction(&cameratoworld, ray->D); ray->D = normalize(ray->D); @@ -101,6 +106,11 @@ __device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, floa /* transform ray from camera to world */ Transform cameratoworld = kernel_data.cam.cameratoworld; +#ifdef __MOTION__ + if(ray->time != TIME_INVALID) + transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time); +#endif + ray->P = transform_point(&cameratoworld, ray->P); ray->D = transform_direction(&cameratoworld, ray->D); ray->D = normalize(ray->D); @@ -136,6 +146,11 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float /* transform ray from camera to world */ Transform cameratoworld = kernel_data.cam.cameratoworld; +#ifdef __MOTION__ + if(ray->time != TIME_INVALID) + transform_motion_interpolate(&cameratoworld, &kernel_data.cam.motion, ray->time); +#endif + ray->P = transform_point(&cameratoworld, ray->P); ray->D = transform_direction(&cameratoworld, ray->D); ray->D = normalize(ray->D); @@ -162,14 +177,20 @@ __device void camera_sample_environment(KernelGlobals *kg, float raster_x, float /* Common */ -__device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, float filter_v, float lens_u, float lens_v, Ray *ray) +__device void camera_sample(KernelGlobals *kg, int x, int y, float filter_u, float filter_v, + float lens_u, float lens_v, float time, Ray *ray) { /* pixel filter */ float raster_x = x + kernel_tex_interp(__filter_table, filter_u, FILTER_TABLE_SIZE); float raster_y = y + kernel_tex_interp(__filter_table, filter_v, FILTER_TABLE_SIZE); +#ifdef __MOTION__ /* motion blur */ - //ray->time = lerp(time_t, kernel_data.cam.shutter_open, kernel_data.cam.shutter_close); + if(kernel_data.cam.shuttertime == 0.0f) + ray->time = TIME_INVALID; + else + ray->time = 0.5f + (time - 0.5f)*kernel_data.cam.shuttertime; +#endif /* sample */ if(kernel_data.cam.type == CAMERA_PERSPECTIVE) |