如何动画在OpenGL 3D模型(目)? [英] How to animate a 3d model (mesh) in OpenGL?

查看:166
本文介绍了如何动画在OpenGL 3D模型(目)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想动画的模型(例如人类,步行)在OpenGL。我知道有这样的东西骨骼动画(与棘手的数学),但对于这个....

I want to animate a model (for example a human, walking) in OpenGL. I know there is stuff like skeleton-animation (with tricky math), but what about this....


  1. 创建在搅拌机模型

  2. 在搅拌机该模型创建一个骨架

  3. 现在,做一个行走动画搅拌机与模型和骨架

  4. 采取一些动画关键帧,每一个关键帧导出为一个单一的模式
    (例如,作为OBJ文件)

  5. 请对OpenGL的OBJ文件加载器(获得顶点,纹理,正常和面部数据)

  6. 使用一个VBO绘制在OpenGL的动画模型(并得到一些棘手的想法如何改变目前的关键帧的VBO /模型......也许一些与 glMapBufferRange

  1. Create a model in Blender
  2. Create a skeleton for that model in Blender
  3. Now do a walking animation in Blender with that model and skeleton
  4. Take some "keyFrames" of that animation and export every "keyFrame" as a single model (for example as obj file)
  5. Make an OBJ file loader for OpenGL (to get vertex, texture, normal and face data)
  6. Use a VBO to draw that animated model in OpenGL (and get some tricky ideas how to change the current "keyFrame"/model in the VBO ... perhaps something with glMapBufferRange

好吧,我知道这个想法仅仅是一个小脚本,但它是值得探讨进一步?
什么是一个很好的概念,以改变关键帧/车型在VBO?

Ok, I know this idea is only a little script, but is it worth looking into further? What is a good concept to change the "keyFrame"/models in the VBO?

我知道,内存的问题,但与小模型(并没有太多的动画),这是可以做到的,我想。

I know that memory problem, but with small models (and not too much animations) it could be done, I think.

推荐答案

是的,你是指该方法在早期的3D视频游戏(地震等)非常受欢迎。

Yes, the method you are referring to was very popular in early 3D video games (quake, etc).

我建议实施它略有不同,那么你描述。而不是出口关键帧动画的每一个可能的框架。导出多个S $ P $垫出来键和插值顶点位置。这将允许更平滑的播放与显著使用更少的内存。

I would suggest implementing it slightly differently then you described. Instead of exporting a keyframe for every possible frame of animation. Export more spread out keys and interpolate the vertex positions. This will allow much smoother playback with significantly less memory usage.

这将需要只是一个单一的(流媒体,或动态)VBO。每个帧你会发现previous和下一个关键帧,内插的顶点,并将结果上载到VBO

This would require just a single (streaming, or dynamic) VBO. Each frame you would find the previous and next keyframes, interpolate the vertices, and upload the result into the VBO.

实际上,你可以设置搅拌机场景的每一帧导出为OBJ。然后自定义工具可以编译这些文件到一个不错的动画格式。

You can actually setup blender to export every frame of a scene as an OBJ. A custom tool could then compile these files into a nice animation format.

在这里阅读:

http://en.wikipedia.org/wiki/MD2_(file_format)

http://tfc.duke.free.fr /coding/md2-specs-en.html

这篇关于如何动画在OpenGL 3D模型(目)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆