Smooth animation and frame transition

Started by
10 comments, last by Bombshell93 12 years ago
I did some fiddling around and I've got animations and mesh data loading perfectly (so far as I can tell)
problem is now I have the animations keys, I'm not sure how I should interpolate them. I could have it just linear interpolate but I'd imagine that'd lead to rather stiff animations?
what would I do alternatively?

atm my Node (bone) class is held independently per animation,
it has its index, used for identification in the shader with the vertices.
it has position keys (in a map, time as key, position as value)
rotation quaternion keys (map, time as key, rotation as value)
scaling keys (map, time as key, scaling as value)

with the time as the key, its simple enough to pass the current animation relative time and get the upper and lower bounds of that value. from there linear interpolation is fairly straight forward,
InterpolationValue = (CurrentTime - LowerTime) / (Uppertime - LowerTime); //which should give a value between 0 and 1 to use as the interpolation value.
but how would I have this smoothly transition into other frames or other animations? could I keep 2 Previous matrices and estimate some kind of curved interpolation?

Once again any and all help appreciated,
Thanks in advanced,
Bombshell
Advertisement
I've found my way around smooth animation via http://www.gamedev.n...aced-keyf-r1497
But I have a new problem I'm getting the following error
Direct3D9: (ERROR) :ps_3_0 shader can only be used with vs_3_0+ shader (SWVP or HWVP), or transformed vertices.
With the HResult returning "The pipe state is invalid"
Here is my .fx file at the moment.

float4x4 World : WORLDMATRIX;
float4x4 View : VIEWMATRIX;
float4x4 Proj : PROJMATRIX;

float4x4 Transforms[64] : BONES;

struct VSI
{
float4 Position : POSITION;
float3 Weights : BLENDWEIGHT;
float4 Indices : BLENDINDICES;
float2 UV : TEXCOORD;
};

struct VSO
{
float4 Position : SV_POSITION;
float2 UV : TEXCOORD;
};

VSO VS(VSI input)
{
VSO output;
float4 BlendPosition = mul(input.Position, Transforms[input.Indices.x]) * input.Weights.x;
BlendPosition += mul(input.Position, Transforms[input.Indices.y]) * input.Weights.y;
BlendPosition += mul(input.Position, Transforms[input.Indices.z]) * input.Weights.z;
BlendPosition += mul(input.Position, Transforms[input.Indices.w]) * (1 - input.Weights.x - input.Weights.y - input.Weights.z);
float4 Position = mul(BlendPosition, World);
Position = mul(Position, View);
output.Position = mul(Position, Proj);
output.UV = input.UV;
return output;
}

float4 PS(VSO input) : SV_TARGET
{
return float4(input.UV, 1, 1);
}

technique Default
{
pass p0
{
VertexShader = compile vs_3_0 VS();
PixelShader = compile ps_3_0 PS();
}
}

This topic is closed to new replies.

Advertisement