Sign in to follow this  
TrueTom_

Interpolating cameras

Recommended Posts

TrueTom_    122
Hi, I'm trying to interpolate camera matrices. I have two matrices, camSrc and camDst, both are 4x4 matrices. The 3x3 rotation part contains a basis within the camera lies, the translation part contains the point where the camera stands. The matrices get basicly feed into gluLookAt. My scene only consist of one object and the matrices define diffrent views on it. I want to switch between the views and move the camera around the object. I'm currently calculating the rotation matrix to map one basis upon the other. From this matrix I extract the euler angles and interpolate them. Then I create a matrix from them and multiply it with the camSrc. The camera point (the "translation" - vector) gets linear interpolated. This works fine if I only rotate the camera or if I only move the camera. Doing both at the same time leads to some wierd movement. For any help thanks in advance... :) Tom

Share this post


Link to post
Share on other sites
alvaro    21246
Interpolation of Euler angles a well-known problem called Gimbal lock. Interpolating the translation linearly seems natural enough, and for the rotation part, use quaternions.

Also, if both cameras are looking directly at the same object, you might be better off interpolating only the translation part and forcing the angle to always look at that object. Otherwise intermediate camera positions may not leave the object in the center of the image.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this