diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-03-10 02:37:07 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-03-10 06:54:05 +0300 |
commit | 267d8923265a284c5d9a462e1d86305d613fcad8 (patch) | |
tree | 7e0bd31d403a4d878ec65aaac3883bbfea67cc20 /intern/cycles/kernel | |
parent | 6c4ddfc5d9833b6c4f0ae3da93645556fee97caf (diff) |
Code refactor: motion blur cleanups, preparing for next commit.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/geom/geom_object.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/geom/geom_primitive.h | 12 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_camera.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_textures.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 14 |
5 files changed, 23 insertions, 21 deletions
diff --git a/intern/cycles/kernel/geom/geom_object.h b/intern/cycles/kernel/geom/geom_object.h index 62bc46dc21b..a7191c50e97 100644 --- a/intern/cycles/kernel/geom/geom_object.h +++ b/intern/cycles/kernel/geom/geom_object.h @@ -32,8 +32,8 @@ enum ObjectTransform { }; enum ObjectVectorTransform { - OBJECT_VECTOR_MOTION_PRE = 0, - OBJECT_VECTOR_MOTION_POST = 1 + OBJECT_PASS_MOTION_PRE = 0, + OBJECT_PASS_MOTION_POST = 1 }; /* Object to world space transformation */ @@ -68,10 +68,10 @@ ccl_device_inline Transform lamp_fetch_transform(KernelGlobals *kg, int lamp, bo /* Object to world space transformation for motion vectors */ -ccl_device_inline Transform object_fetch_vector_transform(KernelGlobals *kg, int object, enum ObjectVectorTransform type) +ccl_device_inline Transform object_fetch_motion_pass_transform(KernelGlobals *kg, int object, enum ObjectVectorTransform type) { - int offset = object*OBJECT_VECTOR_SIZE + (int)type; - return kernel_tex_fetch(__objects_vector, offset); + int offset = object*OBJECT_MOTION_PASS_SIZE + (int)type; + return kernel_tex_fetch(__object_motion_pass, offset); } /* Motion blurred object transformations */ diff --git a/intern/cycles/kernel/geom/geom_primitive.h b/intern/cycles/kernel/geom/geom_primitive.h index 4e84446bae0..c159be92885 100644 --- a/intern/cycles/kernel/geom/geom_primitive.h +++ b/intern/cycles/kernel/geom/geom_primitive.h @@ -193,10 +193,10 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData * * transformation was set match the world/object space of motion_pre/post */ Transform tfm; - tfm = object_fetch_vector_transform(kg, sd->object, OBJECT_VECTOR_MOTION_PRE); + tfm = object_fetch_motion_pass_transform(kg, sd->object, OBJECT_PASS_MOTION_PRE); motion_pre = transform_point(&tfm, motion_pre); - tfm = object_fetch_vector_transform(kg, sd->object, OBJECT_VECTOR_MOTION_POST); + tfm = object_fetch_motion_pass_transform(kg, sd->object, OBJECT_PASS_MOTION_POST); motion_post = transform_point(&tfm, motion_post); float3 motion_center; @@ -207,10 +207,10 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData * ProjectionTransform projection = kernel_data.cam.worldtoraster; motion_center = transform_perspective(&projection, center); - projection = kernel_data.cam.perspective_motion.pre; + projection = kernel_data.cam.perspective_pre; motion_pre = transform_perspective(&projection, motion_pre); - projection = kernel_data.cam.perspective_motion.post; + projection = kernel_data.cam.perspective_post; motion_post = transform_perspective(&projection, motion_post); } else { @@ -220,13 +220,13 @@ ccl_device_inline float4 primitive_motion_vector(KernelGlobals *kg, ShaderData * motion_center.x *= kernel_data.cam.width; motion_center.y *= kernel_data.cam.height; - tfm = kernel_data.cam.pass_motion.pre; + tfm = kernel_data.cam.motion_pass_pre; motion_pre = normalize(transform_point(&tfm, motion_pre)); motion_pre = float2_to_float3(direction_to_panorama(&kernel_data.cam, motion_pre)); motion_pre.x *= kernel_data.cam.width; motion_pre.y *= kernel_data.cam.height; - tfm = kernel_data.cam.pass_motion.post; + tfm = kernel_data.cam.motion_pass_post; motion_post = normalize(transform_point(&tfm, motion_post)); motion_post = float2_to_float3(direction_to_panorama(&kernel_data.cam, motion_post)); motion_post.x *= kernel_data.cam.width; diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h index 755c3472072..a0be0ba6454 100644 --- a/intern/cycles/kernel/kernel_camera.h +++ b/intern/cycles/kernel/kernel_camera.h @@ -54,13 +54,13 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo * interpolated field of view. */ if(ray->time < 0.5f) { - ProjectionTransform rastertocamera_pre = kernel_data.cam.perspective_motion.pre; + ProjectionTransform rastertocamera_pre = kernel_data.cam.perspective_pre; float3 Pcamera_pre = transform_perspective(&rastertocamera_pre, raster); Pcamera = interp(Pcamera_pre, Pcamera, ray->time * 2.0f); } else { - ProjectionTransform rastertocamera_post = kernel_data.cam.perspective_motion.post; + ProjectionTransform rastertocamera_post = kernel_data.cam.perspective_post; float3 Pcamera_post = transform_perspective(&rastertocamera_post, raster); Pcamera = interp(Pcamera, Pcamera_post, (ray->time - 0.5f) * 2.0f); diff --git a/intern/cycles/kernel/kernel_textures.h b/intern/cycles/kernel/kernel_textures.h index 6e07d88008e..564b3f0f79c 100644 --- a/intern/cycles/kernel/kernel_textures.h +++ b/intern/cycles/kernel/kernel_textures.h @@ -32,7 +32,8 @@ KERNEL_TEX(float2, __prim_time) /* objects */ KERNEL_TEX(KernelObject, __objects) -KERNEL_TEX(Transform, __objects_vector) +KERNEL_TEX(Transform, __object_motion_pass) +KERNEL_TEX(uint, __object_flag) /* triangles */ KERNEL_TEX(uint, __tri_shader) @@ -66,7 +67,6 @@ KERNEL_TEX(KernelParticle, __particles) /* shaders */ KERNEL_TEX(uint4, __svm_nodes) KERNEL_TEX(KernelShader, __shaders) -KERNEL_TEX(uint, __object_flag) /* lookup tables */ KERNEL_TEX(float, __lookup_table) diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 567f2a04028..6743cc62894 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -35,10 +35,10 @@ CCL_NAMESPACE_BEGIN /* Constants */ -#define OBJECT_VECTOR_SIZE 2 -#define FILTER_TABLE_SIZE 1024 -#define RAMP_TABLE_SIZE 256 -#define SHUTTER_TABLE_SIZE 256 +#define OBJECT_MOTION_PASS_SIZE 2 +#define FILTER_TABLE_SIZE 1024 +#define RAMP_TABLE_SIZE 256 +#define SHUTTER_TABLE_SIZE 256 #define BSSRDF_MIN_RADIUS 1e-8f #define BSSRDF_MAX_HITS 4 @@ -1205,10 +1205,12 @@ typedef struct KernelCamera { /* Stores changes in the projeciton matrix. Use for camera zoom motion * blur and motion pass output for perspective camera. */ - PerspectiveMotionTransform perspective_motion; + ProjectionTransform perspective_pre; + ProjectionTransform perspective_post; /* Transforms for motion pass. */ - MotionTransform pass_motion; + Transform motion_pass_pre; + Transform motion_pass_post; int shutter_table_offset; |