Skip to main content
GameDev.net gamedev.net
🔒 Locked

jittering when interpolating key frames

Started by 16bit_port Jun 10, 2010 at 4:27 PM 0 replies 700+ views
Original Post
16bit_port
16bit_port
JointLocalParams InterpAnimJoint;JointLocalParams &BeginAnimJoint = Frame.Joints[j];JointLocalParams &EndAnimJoint = NextFrame.Joints[j];//////// interpolation!!!!!	float InterpValue = FrameTimer.ElapsedTime()/FrameTimer.IntervalLength;	if( InterpValue > 1.f )		InterpAnimJoint = EndAnimJoint;	else if( InterpValue == 0.f )		InterpAnimJoint = BeginAnimJoint;	else if( BeginAnimJoint.Rotation == EndAnimJoint.Rotation )	{		InterpAnimJoint.Rotation = BeginAnimJoint.Rotation;		D3DXVec4Lerp( &InterpAnimJoint.Position, &BeginAnimJoint.Position, &EndAnimJoint.Position, InterpValue );		D3DXVec4Lerp( &InterpAnimJoint.Scale, &BeginAnimJoint.Scale, &EndAnimJoint.Scale, InterpValue );	}	else	{		//D3DXQuaternionNormalize( &BeginAnimJoint.Rotation, &BeginAnimJoint.Rotation );		//D3DXQuaternionNormalize( &EndAnimJoint.Rotation, &EndAnimJoint.Rotation );		D3DXQuaternionSlerp( &InterpAnimJoint.Rotation, &BeginAnimJoint.Rotation, &EndAnimJoint.Rotation, InterpValue );		//D3DXQuaternionNormalize( &InterpAnimJoint.Rotation, &InterpAnimJoint.Rotation );		D3DXVec4Lerp( &InterpAnimJoint.Position, &BeginAnimJoint.Position, &EndAnimJoint.Position, InterpValue );		D3DXVec4Lerp( &InterpAnimJoint.Scale, &BeginAnimJoint.Scale, &EndAnimJoint.Scale, InterpValue );	}


FrameTimer.ElapsedTime() is CurrentTimeStamp - PreviousTimeStamp

and

FrameTimer.IntervalLength is the time length we're checking against (in this case, the length of the frame)

Any thoughts?

Works fine if I always set it to BeginAnimJoint or EndAnimJoint (just a little bit choppy - as expected)

[Edited by - 16bit_port on June 10, 2010 5:08:22 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.