开发者

OpenGL animation

开发者 https://www.devze.com 2023-01-26 05:34 出处:网络
If I have a human body 3d model, that I want to animate walking, what is the best way to achieve this? Here are the possible ways I see this being implemented:

If I have a human body 3d model, that I want to animate walking, what is the best way to achieve this? Here are the possible ways I see this being implemented:

  • Create several models with the legs in different positions and then interpolate between these models.
  • Load the model into openGL, and somehow figure which vertices correspond to the legs and perform the appropriate transf开发者_JAVA百科ormations.
  • Implement a skeleton or armature (similar to this: blender animation wiki).


Technique that you described in the first option is called morph target animation and often used for some detailes of animation like facial animation or maybe opening and closing of hands.

Second option is procedural or physical animation which works something like robotics where you give the body of your character some velocity to move forward and calculate what legs need to do for it to avoid falling. But you wouldn't do it directly on vertices, but on skeleton. See next one.

Third option is skeletal animation which animates skeleton and the vertices follow it by the set of rules. Attaching vertices to skeleton is called skinning.

I suggest that, after getting hang of opengl stuff (viewing and positioning models in space, camera, etc), you start with skeletal animation.

You will need a rigged and animated model for your 3d app of choice. Then you can write an exporter to your custom format or choose a format that you want to read from your app. That file format should contain description of the model, skeleton, skinning and key frames. Than you read and use that data from your code to build the mesh, skeleton and animate over key frames.


If I were you, I'd download Blender from http://www.blender.org and work through some animation tutorials. For example, this one:

http://wiki.blender.org/index.php/Doc:Tutorials/Animation/BSoD/Character_Animation

Having done that, you can then export your model and animations using e.g. the Ogre exporter. I think this is the latest version, but check to make sure:

http://www.ogre3d.org/tikiwiki/Blender+Exporter&structure=Tools

From there, you just need to write the C++ code to load everything in, interpolate between keyframes, etc. I have code I can show you for this if you're interested.

0

精彩评论

暂无评论...
验证码 换一张
取 消