[size=1]I'm writing the function to process the aiScene into the Model object,
My Model Layout is basicly:
Current Transforms + Model -> ModelParts . Bones + Animations + Material + Mesh . MeshParts . VertexBuffer + IndexBuffer
The Vertices contain position, uv, normal, bitangent, tanget, bone weights and bone index.
bone weights are 3 floats and a forth will be found by assuming they all add up to 1.
Animations hold their name and frames consisting of a time frame, bones and their index (so for example leg only animations can be kept)
And bones contain only their transform and a pointer to their parent and children.
The vertex position, uv, normal, bitangent and tangent are all kept together easy peasy. But I don't know how the per vertex bone weights and index are found.
Similarly the animations confuse me, scattered in pieces all over the places!
Any and all help would be greatly appreciated,
Thanks in advanced,
Bombshell
I did some fiddling around and I've got animations and mesh data loading fine (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?
EDIT: 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();
}
}
Once again any and all help appreciated,
Thanks in advanced,
Bombshell