Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 03:36:09 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-03-10 08:27:19 +0300
commit78c2063685cb6e0d0bcb895cf4eb70686455d596 (patch)
tree70f7010f9a960f087b3e5b842874a919a4e0860d /intern/cycles/blender/blender_camera.cpp
parent267d8923265a284c5d9a462e1d86305d613fcad8 (diff)
Cycles: support arbitrary number of motion blur steps for cameras.
Diffstat (limited to 'intern/cycles/blender/blender_camera.cpp')
-rw-r--r--intern/cycles/blender/blender_camera.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp
index e5f885c0012..909db8d9449 100644
--- a/intern/cycles/blender/blender_camera.cpp
+++ b/intern/cycles/blender/blender_camera.cpp
@@ -83,6 +83,8 @@ struct BlenderCamera {
Transform matrix;
float offscreen_dicing_scale;
+
+ int motion_steps;
};
static void blender_camera_init(BlenderCamera *bcam,
@@ -226,6 +228,10 @@ static void blender_camera_from_object(BlenderCamera *bcam,
bcam->sensor_fit = BlenderCamera::HORIZONTAL;
else
bcam->sensor_fit = BlenderCamera::VERTICAL;
+
+ if(object_use_motion(b_ob, b_ob)) {
+ bcam->motion_steps = object_motion_steps(b_ob);
+ }
}
else {
/* from lamp not implemented yet */
@@ -453,9 +459,7 @@ static void blender_camera_sync(Camera *cam,
cam->matrix = blender_camera_matrix(bcam->matrix,
bcam->type,
bcam->panorama_type);
- cam->motion.pre = cam->matrix;
- cam->motion.post = cam->matrix;
- cam->use_motion = false;
+ cam->motion.resize(bcam->motion_steps, cam->matrix);
cam->use_perspective_motion = false;
cam->shuttertime = bcam->shuttertime;
cam->fov_pre = cam->fov;
@@ -564,20 +568,15 @@ void BlenderSync::sync_camera_motion(BL::RenderSettings& b_render,
Transform tfm = get_transform(b_ob_matrix);
tfm = blender_camera_matrix(tfm, cam->type, cam->panorama_type);
- if(tfm != cam->matrix) {
- VLOG(1) << "Camera " << b_ob.name() << " motion detected.";
- if(motion_time == 0.0f) {
- /* When motion blur is not centered in frame, cam->matrix gets reset. */
- cam->matrix = tfm;
- }
- else if(motion_time == -1.0f) {
- cam->motion.pre = tfm;
- cam->use_motion = true;
- }
- else if(motion_time == 1.0f) {
- cam->motion.post = tfm;
- cam->use_motion = true;
- }
+ if(motion_time == 0.0f) {
+ /* When motion blur is not centered in frame, cam->matrix gets reset. */
+ cam->matrix = tfm;
+ }
+
+ /* Set transform in motion array. */
+ int motion_step = cam->motion_step(motion_time);
+ if(motion_step >= 0) {
+ cam->motion[motion_step] = tfm;
}
if(cam->type == CAMERA_PERSPECTIVE) {