Jump to content
  • Advertisement
Sign in to follow this  

Interpolation using Squad

This topic is 5471 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I'm trying to smoothly interpolate some camera orientations. It works fine so far using slerp, but unfortunately it's a little jaggy... So I'm trying to use a cubic interpolation aproach now. The thing is, to calculate the in between points, I need the key orientations before and after my keys I wish to interpolate. That is interpolating from q1 to q2 I need q0 and q3. So my question is, I'm not quite sure what to do at the start and end points. Interpolating a spline, I would just stretch the first and last points and use those. But how is this done using quaternions? Is it ok if I just use the start and end point again? I'm trying that now and I get some pretty weird results.

Share this post

Link to post
Share on other sites
Ok, I figured out how to get the additional points.
One article stated to use slerp with a factor of 2.0 between q[first+1] and q[first] (to get q[first-1]). Same goes for the last quaternion in the path.
But I'm still not getting correct results. There is no smooth path between my control points (e.g. the camera orientation at t=0.5 is nowhere near where it's supposed to be).
Im using the following code to get the in between points. (calling with (q-1, q0, q+1) and (q0, q+1, q+2) for an interpolation from q0 to q+1.

Quaternion Quaternion::innerQuadPoint( Quaternion& q0, Quaternion& q1, Quaternion& q2 )
vector3f vTemp, vTemp1, vTemp2;
Quaternion qIntermediate1, qIntermediate2, qResult;

vTemp1 = Quaternion::log( q1.inverse() * q0 );
vTemp2 = Quaternion::log( q1.inverse() * q2 );

vTemp = (vTemp1 + vTemp2) * (-0.25f);

qIntermediate1 = q1 * Quaternion::exp( vTemp );

return qResult;

Any hints?

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!