游戏开发论坛

 找回密码
 立即注册
搜索
查看: 4715|回复: 2

skeleton animation with ASSIMP and OpenGL

[复制链接]

31

主题

257

帖子

1752

积分

金牌会员

申城谍影

Rank: 6Rank: 6

积分
1752
QQ
发表于 2014-5-27 14:41:40 | 显示全部楼层 |阅读模式
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


5

主题

263

帖子

1113

积分

金牌会员

Rank: 6Rank: 6

积分
1113
发表于 2014-6-27 19:56:17 | 显示全部楼层
那么用什么软件制作骨骼动画并导出Collada呢?

31

主题

257

帖子

1752

积分

金牌会员

申城谍影

Rank: 6Rank: 6

积分
1752
QQ
 楼主| 发表于 2014-7-1 13:11:08 | 显示全部楼层
jiangcaiyang 发表于 2014-6-27 19:56
那么用什么软件制作骨骼动画并导出Collada呢?

max比较好用,免费的可以考虑blender,

就是和max界面完全不一样,熟max的,不好上手。。。。。。。。。。。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-2-26 01:52

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表