dev in the making

game development, maya and code by brainzizi

Posts Tagged ‘interpolation

zCamera keyframes and interpolation

leave a comment »

In my camera keyframe following project, I’m using this structure to record keyframes:

TimeSpan Key;
Vector3 Position;
Quaternion Rotation;
float FocalDistance;
zInterpolationType PositionInterpolation;
zInterpolationType FocalDistanceInterpolation;

I’m saving these in 2 lists, one containing the timespan, and the otherone containing zCameraKey (which contains other data from the previous code).

When interpolating between those keyframes you have to be sure it’s first of all smooth. This is a bit harder to achieve, considering you must interpolate 3 things: position (vector3), rotation (quaternion) and focal distance (float). The results are done smoothest with the following: Position interpolation is done using Catmull-Rom XNA built in function. Rotation is interpolated using Slerp – also XNA built in, and focal distance also Catmull-Rom. But the smoothness can be still broken with keyframes with variable distance / time ratio. Why? Because of the speed of change. This can be dealt with, but I should change my entire keyframe following system to achieve that, so I’m giving that up. The designer or whoever is setting up animation cameras should take care of that.

As the saying goes: That’s not a bug. That’s a feature.

Yeah… Because you now control the speed of change. Not some silly algorithm. If you want a smooth camera that doesn’t care about the spacing of the keyframes, use Graphic Runner’s Camera animation @

Also I frapsed some keyframe following action in low res on youtube, check it out:

Also a couple of the latest screens from zCamera:

Written by brainzizizi

08.09.2009 at 21:00

Posted in xna

Tagged with , , , ,