|
i'm an experienced game programmer,
but this issue tortured me nearly 6 months.
i just want to add skeleton animations to my webpage-game,
i do this in free time, i have a fixed job to received salary every month.
at first i parsed Collada file (*.DAE) myself by TinyXML exported from 3dsmax.
then i found, tags and formats in DAE are different if they were exported from
max2010 and max2012.
so assimp would be the first choice.
otherwise, your parser might need to be updated after a few years.
unless your parse supports full tags from Collada format.
i also tried Collada Dom,
failed to compile. some outer-libs need to be recompiled under my VS2012.
so i didn't pay much time on it.
FBX from auto desk is another choice.
it has a skeleton animation example with the SDK.
that sample doesn't use shader, it transforms verts all by CPU.
for some reason, i didn't use it either.
back to main topic:
now i successfully implement the skeleton animation by assimp.
i'll share some tips with people that yet do not succeed.
for people using assimp + opengl
1) matrices in assimp have different major with those in opengl.
so, if you get a matrix from assimp API, you must transpose it then pass to opengl.
if you don't want to write a math-lib.
then glm is a good choice.
2) not all the bones will be got in "aiMesh::mBones",
you only find bones that affecting verts there,
bones affecting no verts will be omitted.
3) for bones not in "aiMesh::mBones",
if they are links in the whole skeleton,
we have to compute their affection when transforming verts.
4) for a bones chain:
bone01(mesh01)->bone02(mesh02)->bone03(no mesh)->bone04(mesh04)
if we want to do final transform to "mesh04":
inverse(aiScene::mRootNode::mTransformation) *
((bone01 translation) * (bone01 rotation) * (bone01 scaling)) *
((bone02 translation) * (bone02 rotation) * (bone02 scaling)) *
(aiNode::mTransformation from (aiNode::mName == bone03->mName)) *
((bone04 translation) * (bone04 rotation) * (bone04 scaling)) *
(bone04->mOffsetMatrix)
that's all i want to share,
after all this is not very difficult topic,
just some details you need to take care...........
regards
|
|