在OpenGL的DirectX文件骨骼动画 [英] Skeletal animation of DirectX files in OpenGL

查看:322
本文介绍了在OpenGL的DirectX文件骨骼动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图导入* .X文件,我的发动机,并使用OpenGL动画他们(不含着色器现在,但现在是不是真的有用)。我发现在MSDN中的格式参考,但它并没有多大帮助的问题。

I'm trying to import *.x files to my engine and animate them using OpenGL (without shaders for now, but that isn't really relevant right now). I've found the format reference at MSDN, but it doesn't help much in the problem.

所以 - 基本上 - 我已经创建了一个包含一个简单的动画文件,恶魔般的7骨头(主,2尾,和4腿),其中只有2(那些在被右腿)此刻的动画。我测试过的DXViewer网格,它似乎完全没有工作,所以问题一定是我的code的一面。

So - basically - I've created a file containing a simple animation of a demon-like being with 7 bones (main, 2 for the tail, and 4 for the legs), from which only 2 (the ones in the right leg) are animated at the moment. I've tested the mesh in the DXViewer, and it seems to work perfectly there, so the problem must be the side of my code.

在我出口中网,我得到一个包含大量信息的文件,从其中有对骨骼动画(所有低于矩阵为RLeg2骨)3个重要的地方:

When I export the mesh, I get a file containing lots of information, from which there are 3 important places for the skeletal animation (all the below matrices are for the RLeg2 bone):


  1. SkinWeights - matrixOffset

  1. SkinWeights - matrixOffset

-0.361238,  -0.932141, -0.024957,  0.000000,
 0.081428,  -0.004872, -0.996669,  0.000000,
 0.928913,  -0.362066,  0.077663,  0.000000,
 0.139213,  -0.057892, -0.009323,  1.000000


  • FrameTransformMatrix

  • FrameTransformMatrix

    0.913144,  0.000000, -0.407637,  0.000000,
    0.069999,  0.985146,  0.156804,  0.000000,
    0.401582, -0.171719,  0.899580,  0.000000,
    0.000000, -0.000000,  0.398344,  1.000000
    


  • 在绑定AnimationKey矩阵构成

  • AnimationKey matrix in bind pose

    0.913144,  0.000000, -0.407637,  0.000000, 
    0.069999,  0.985146,  0.156804,  0.000000,
    0.401582, -0.171719,  0.899580,  0.000000,
    0.000000, -0.000000,  0.398344,  1.000000
    


  • 我的问题是 - 我该怎么正好与这些矩阵做我发现在英国纽卡斯尔大学网站(<公式的HREF =htt​​p://research.ncl.ac?英国/游戏/ mastersdegree / graphicsforgames / skeletalanimation / rel=\"nofollow\">http://research.ncl.ac.uk/game/mastersdegree/graphicsforgames/skeletalanimation/), 。但只有1矩阵存在的问题是 - ?如何合并这些矩阵得到顶点变换矩阵

    My question is - what do I exactly do with these matrices? I've found an equation on the Newcastle University site (http://research.ncl.ac.uk/game/mastersdegree/graphicsforgames/skeletalanimation/), but there's only 1 matrix there. The question is - how do I combine these matrices to get the vertex transform matrix?

    推荐答案

    这帖子不是pretend是一个完整的答案,而是一套有用的链接。

    This post is not pretend to be a full answer, but a set of helpful links.

    如何获得所需的动画中的所有信息。

    现在的问题是你如何导入您的网格,你为什么这样做。你可以用 .X 网​​格打了几个月,但是这并没有任何意义,因为 .X 是一个非常基本的,旧的和真的不够好格式。你没有找到 .X 在计算器上的格式众多粉丝。 =)

    The question is how do you import your mesh, and why do you do this. You can fight with .x meshes for a months, but this doesn't make any sense, because .x is a very basic, old and really not good enough format. You don't find many fans of .x format on StackOverflow. =)

    .X 在一个取巧的办法文件存储动画数据。它的目的是通过集 D3DX *()功能的加载。但是,手动获取骨骼和重量从它,你必须preprocess加载的数据。很多事情要code。这是一个很大的职位,解释如何:

    .x file stores animation data in a tricky way. It was intended to load via set of D3DX*() functions. But, to get bones and weights from it manually, you must preprocess loaded data. Much things to code. Here is a big post, explaining how to:

    <一个href=\"http://www.gamedev.net/page/resources/_/technical/directx-and-xna/loading-and-displaying-x-files-without-directx-r2221\">Loading和显示.X文件,而DirectX的

    好办法做的事情仅仅是切换到一些网格装载库。最流行的和普遍的一种是 Assimp 。至少,看看他们的文档和/或源$ C ​​$ C,他们如何处理负载和preprocessing,什么乳清具有作为输出。此外,这里是一个很好的解释:

    Good way to do things is just switch to some mesh loading library. The most popular and universal one is Assimp. At least, look at their docs and/or source code, on how they handle loading and preprocessing, and what whey have as output. Also, here is a good explanation:

    教程38 - 骨骼动画有了Assimp

    所以,用assimp可以停止战斗,开始现在动画。也许以后,当你将它如何的作品找到主意,你可以写自己的装载机。

    So, with assimp you can stop fighting and begin animating right now. And maybe later, when you'll find idea on how it's works, you can write your own loader.

    当你有需要动画的所有信息

    骨骼动画的是,在各地的网络细节解释一个基本的话题。

    Skeletal animation is a basic topic that explained in details all around the web.

    • You can find basic vertex shader for animation here: OpenGL Wiki: Skeletal Animation
    • Here is a explanation of how all works (but implemented in fixed-function style): Basic Bones System

    希望它帮助!

    这篇关于在OpenGL的DirectX文件骨骼动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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