diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-18 18:42:18 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-11-18 18:42:18 +0400 |
commit | dae43b5487ca97e691ce3cd3d688205255cd05fb (patch) | |
tree | bde4b5f63554305a6fcfa6db0b3cd43ce42009bf /source/blender/blenkernel/intern/tracking.c | |
parent | cc314e442c1dfc6646be0d04675c3dc16cfc2eaf (diff) |
Camera tracking: multiply all camera matrices by inverted first reconstructed camera matrix
This makes blender camera:
- Be located on exactly the same position at first frame after applying
Camera Solver constraint
- Be looking in exactly the same direction it used to look before
applying Camera Solver constraint
Before this patch in most of cases camera used to change direction
after applying solved data on it which can be confusing in some cases.
Currently solved files wouldn't be broken, but after solve scene should
be re-oriented. Not big deal because re-solving isn't so safe for scene
orientation anyway.
Diffstat (limited to 'source/blender/blenkernel/intern/tracking.c')
-rw-r--r-- | source/blender/blenkernel/intern/tracking.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 59fdf403f0f..49e6d598ea2 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1285,8 +1285,10 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib MovieTrackingTrack *track; MovieTrackingReconstruction *reconstruction= &tracking->reconstruction; MovieReconstructedCamera *reconstructed; - float origin[3]= {0.0f, 0.0f, 0.0f}; int ok= 1; + float imat[4][4]; + + unit_m4(imat); track= tracking->tracks.first; while(track) { @@ -1354,12 +1356,13 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib mat[i][j]= matd[i][j]; if(!origin_set) { - copy_v3_v3(origin, mat[3]); + copy_m4_m4(imat, mat); + invert_m4(imat); origin_set= 1; } if(origin_set) - sub_v3_v3(mat[3], origin); + mul_m4_m4m4(mat, mat, imat); copy_m4_m4(reconstructed[reconstruction->camnr].mat, mat); reconstructed[reconstruction->camnr].framenr= a; @@ -1380,7 +1383,7 @@ static int retrieve_libmv_reconstruct_tracks(MovieTracking *tracking, struct lib track= tracking->tracks.first; while(track) { if(track->flag&TRACK_HAS_BUNDLE) - sub_v3_v3(track->bundle_pos, origin); + mul_v3_m4v3(track->bundle_pos, imat, track->bundle_pos); track= track->next; } |