将 Maya ASCII 导入游戏
我目前正在为我的独立游戏创建一个基于导入的管道,使用 Maya ASCII .ma 作为源格式,并使用我自己的物理和图形格式作为输出。 我将在 Maya 内部保留诸如运动范围属性之类的内容,例如铰链关节。 其他类型的需要大量调整的参数最终会出现在单独的源文件中(可能是 .ini,用于质量、弹簧常数、物理引擎的强度等)。
因此,输入是一个 .ma 和一个 .ini,输出是一个 .physical 和几个 .mesh 文件(每个几何体/材质一个 .mesh 文件)。
我也可能会使用 Python 3.1 重新格式化数据,并且我已经找到了一些可以读取基本 Maya ASCII 的 LGPL 2.1 代码。 我可能还会在开发过程中使用 Python 来启动该平台。 游戏是用C++开发的。
对于这一切,您有什么建议反对的吗? 对可能存在缺陷的事情的快速总结:
- 基于导入的管道(不是基于导出的)?
- 玛雅(不是 3DS)?
- Maya ASCII .ma(不是 .mb)?
- .ini(不是.xml)?
- Maya 中的运动属性与 .ini 中的“freak-tweak”属性分离(并非全部在 Maya 中)?
- Python 3.1 用于构建数据(不是嵌入式 C++)?
编辑:如果您对如何实现物理/图形导入/导出工具链有更好的建议,我将不胜感激。
I am currently working on creating an import-based pipeline for my indie game using Maya ASCII .ma as source format and my own format for physics and graphics as output. I'll keep stuff like range-of-motion attributes inside Maya, such as for a hinge joint. Other types of parameters that needs a lot of tweaks end up in separate source files (possibly .ini for stuff like mass, spring constants, strength of physical engines and the like).
The input is thus one .ma and one .ini, and the output is, among other things, one .physics and several .mesh files (one .mesh file per geometry/material).
I am also probably going to use Python 3.1 to reformat the data, and I already found some LGPL 2.1 code that reads basic Maya ASCII. I'll probably also use Python to launch the platform during development. Game is developed in C++.
Is there anything in all of this which you would advice against? A quick summary of things that might be flawed:
- Import-based pipeline (not export-based)?
- Maya (not 3DS)?
- Maya ASCII .ma (not .mb)?
- .ini (not .xml)?
- Separation of motion attibutes in Maya and "freak-tweak" attributes in .ini (not all in Maya)?
- Python 3.1 for building data (not embedded C++)?
Edit: if you have a better suggestion of how to implement the physics/graphics import/export tool chain, I'd appreciate the input.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果你真的想这样做,你应该注意一些事情。 主要的一点是,这可能比您最初预期的更麻烦。 其他一些是:
rt 到三角形。
If you really want to do this, you should be aware of a few things. The main one being that it's probably more of a hassle than you'd first expect. Some others are:
rt to triangles.
作为人类可读和可写的通用序列化格式,具有出色的 Python 支持(而且,实际上支持任何语言),您可能需要考虑在 ini 文件或 XML 上使用 YAML 或 JSON。
如果您从不手动生成文件,那么 XML 在您的情况下是可以接受的。
JSON 和 YAML 的优点之一是类型:这两种格式都被解析为 Python 列表、字典、浮点数、整数……基本上:健全的 Python 类型。
另外,除非您确定您将使用的每个库都可以在 3.1 上运行,否则由于库可用性问题,您可能需要考虑暂时使用 2.x。
As a general serialization format that's both human readable and human writable, has excellent Python support (and, well, any language support really), you might want to consider using YAML or JSON over ini files or XML.
XML could be acceptable in your case if you never generate files by hand.
One of the advantages of JSON and YAML is typing: both formats are parsed down to Python lists, dictionaries, floats, ints... Basically: sane python types.
Also, unless you're sure that every library you'll ever use works on 3.1, you might want to consider sticking with 2.x for a bit due to library availability issues.
您应该考虑使用基于导出的管道或标准化文件格式(例如 OBJ 或 COLLADA),而不是重新实现 .ma 解析器并复制解释它所需的所有 Maya 内部结构。
.ma/.mb 格式不适合由 Maya 本身以外的任何程序读取,因此 Autodesk 并未付出任何努力来使此过程变得简单。 要 100% 正确地解析它,您需要实现整个 MEL 脚本语言。
我见过的所有基于 Maya 的管道要么首先将内容导出为标准化文件格式,要么在 Maya 中运行 MEL 脚本以使用 MEL 节点接口转储内容。
请注意,Maya 可以在“无头”模式下运行,在该模式下,它会加载场景、执行 MEL 脚本并存在,而无需加载 GUI。 因此在自动化构建系统中使用它是没有问题的。
You should consider using an export-based pipeline or a standardized file format such as OBJ or COLLADA instead of re-implementing a .ma parser and replicating all the Maya internals necessary to interpret it.
The .ma/.mb format is not intended to be read by any program other than Maya itself, so Autodesk does not put any effort into making this an easy process. To parse it 100% correctly you would need to implement the whole MEL scripting language.
All of the Maya-based pipelines I've seen either first export content into a standardized file format, or run MEL scripts within Maya to dump content using the MEL node interfaces.
Note than Maya can be run in a "headless" mode where it loads a scene, executes a MEL script, and exists, without loading the GUI. Thus there is no problem using it within automated build systems.