在 Android 上渲染 Maya 动画?
我已经能够将 3D 模型从 Maya 导入到 OBJ 文件中,然后我的 Android 应用程序可以读取这些文件。现在可以显示该模型,并且我也可以对其应用变换,甚至可以在高多边形数对象上应用变换,这很好。
下一步是确定是否有任何合理的方法来显示 Maya 中定义的动画。我真的不知道如何解决这个问题,而且我对此的初步研究基本上是空的。
以前有人尝试过吗?如果是这样,这将如何运作?
I've been able to import 3D models from Maya into OBJ files, which in turn, are read by my Android app. This model can now be displayed and I can apply transformations on them as well, even on high-polygon count objects, which is nice.
The next step is to figure out if there's any reasonable way to display animation defined within Maya. I really have no clue how to approach this and my initial research on this essentially came up empty.
Has anyone attempted this before? If so, how would this work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为值得注意的是,这个问题与玛雅几乎没有关系或完全没有关系。 Maya 的文件格式是专有且不透明的;你找不到直接在 Android 上显示它们的方法(或者其他任何地方,来吧)。但您可以将数据从 Maya 导出为(基本上)任何格式,这正是您真正想要做的。
因此,流程如下:
有很多方法可以完成第 1 步。为了纯粹的易用性,我自己可能会选择 Unity。基本上它是游戏开发工具,可以创建在 Android(以及 iOS、OSX、Windows 等)上运行的 3D 应用程序和游戏。它不是免费的 - Android 插件售价 400 美元 - 但如果你真的打算用 Android 做任何严肃的事情,你会发现这是值得的。有了它,在 Unity 中制作一个显示动画模型的小型 Android 应用程序实际上非常简单(很多 3D Android 和 iOS 游戏都是在 Unity 中制作的)。 Unity 还需要 FBX 格式的模型和动画,这是一种广泛支持的交换格式 - 将 Maya 中的内容转换为 FBX 不会有任何问题。
如果您在步骤 1 中使用了 Unity,那么步骤 2 就很简单:将模型从 Maya 导出为 FBX,然后就完成了。如果您决定推出自己的 Android 渲染应用程序,那么祝您好运。 :)
无论如何,重点是您想要做的是找到一个在 Android 上渲染动画模型的通用解决方案,然后才弄清楚如何从 Maya 中获取内容。
I think it's worth noting that this question has little or nothing to do with Maya. Maya's file formats are proprietary and opaque; you will NOT find a way to directly display them on Android (or anywhere else, come to that). But you can export data from Maya to (basically) any format, which is what you actually want to do.
So, here's the process:
There's a lot of ways to do step 1. For sheer ease of use I'd probably go for Unity myself. Basically it's game development tool that can create 3D apps and games that run on Android (and iOS, OSX, Windows, etc.) It's not free - the Android addon costs $400 - but if you're actually planning on doing anything serious with Android, you'll find it worthwhile. With it, it's actually pretty trivial to make a little Android app in Unity that displays an animated model (and a LOT of 3D Android and iOS games are made in Unity). Unity also wants models and animations in FBX format, which is a widely supported interchange format - you'll have no problems getting stuff out of Maya into FBX.
If you've gone with Unity in step 1, then step 2 is trivial: Export your models from Maya as FBXes, and you're done. If you've decided to roll your own Android rendering app, well, good luck. :)
Anyhow, the point is that what you want to do is find a generic solution for rendering animated models on Android, and only then figure out how to get your content out of Maya.
为什么不只将关键帧导出到 obj 文件,而不是像Spicyweenie 建议的那样将每个单独的帧输出到单独的 obj 文件。在代码中实现插值以填充缺失的帧。如果您的模型很复杂,您可能希望将插值模型缓存在内存中,但至少您不必从文件中全部加载它们。
Instead of outputting each individual frame to a separate obj file like spicyweenie suggests, why not export just keyframes to obj files. Implement interpolation in your code in order to fill in the missing frames. If your models are complex, you'll probably want to cache the interpolated models in memory, but at least you don't have to load them all from files too.
与科迪·哈奇的回答不同,我对此也很感兴趣。这是我关于模型动画的理论:
假设您的模型有 30 帧。一种方法是将每个帧导出为单独的 OBJ 模型。从那里,您可以为这 30 个 OBJ 创建一个文件夹。现在您总共有 31 个文件。如果用户点击按钮,技巧就是根据按钮(或任何操作)有效的时间长度按顺序加载每个 OBJ。如果持续时间超过 1 秒(30 帧),则循环回到开头。
这一理论的唯一问题是,如果您尝试将很多东西加载到一个场景中,它很可能是资源和电力密集型的,更不用说,会占用空间。
Unlike Cody Hatch's answer, I'm interested in this too. This is my theory as to come about animating a model:
Lets say your model has 30 frames. One way would be to export each frame as an individual OBJ model. From there, you can possible make a folder for those 30 OBJs. So now you have 31 files total. If the person hits a button, the trick would be to load each OBJ in order according to the length of time the button (or whatever action) is valid. and if it lasts over 1 second (30 frames), loop back to the beginning.
The only problem with this theory is that it would most-likely be resource and power intensive, not to mention, a space hog if you try to load a lot of things into one scene.