Cycles: Fixed broken camera motion blur when motion was not set to center on frame
authorStefan Werner <stewreo@gmail.com>
Sat, 12 Aug 2017 20:04:42 +0000 (22:04 +0200)
committerStefan Werner <stewreo@gmail.com>
Mon, 14 Aug 2017 18:24:30 +0000 (20:24 +0200)
Reviewers: #cycles, sergey

Reviewed By: #cycles, sergey

Subscribers: sergey

Differential Revision: https://developer.blender.org/D2787

intern/cycles/blender/blender_camera.cpp

index 40d6b25f2b717bc2fb2a6f0e27e4b73a86c2d942..b29711d30d348cd1bd7f7d46b94e765c11fd0941 100644 (file)
@@ -544,7 +544,11 @@ void BlenderSync::sync_camera_motion(BL::RenderSettings& b_render,
 
        if(tfm != cam->matrix) {
                VLOG(1) << "Camera " << b_ob.name() << " motion detected.";
-               if(motion_time == -1.0f) {
+               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;
                }
@@ -573,7 +577,10 @@ void BlenderSync::sync_camera_motion(BL::RenderSettings& b_render,
                float fov = 2.0f * atanf((0.5f * sensor_size) / bcam.lens / aspectratio);
                if(fov != cam->fov) {
                        VLOG(1) << "Camera " << b_ob.name() << " FOV change detected.";
-                       if(motion_time == -1.0f) {
+                       if(motion_time == 0.0f) {
+                               cam->fov = fov;
+                       }
+                       else if(motion_time == -1.0f) {
                                cam->fov_pre = fov;
                                cam->use_perspective_motion = true;
                        }