从maya导入物体 Importing Objects From Maya

时间:2022-01-09 18:23:31

原地址:http://game.ceeger.com/Manual/HOWTO-ImportObjectMaya.html

Unity natively imports Maya files. To get started, simply place your .mb or .ma file in your project's Assets folder. When you switch back into Unity, the scene is imported automatically and will show up in the Project view.

Unity3d可以直接导入maya文件。让我们来做一个简单的例子,直接将.mb 或者.ma文件放置到你的工程资源文件夹下面,当你切换回unity3d的时候你会发现,资源会自动导入,并在你的工程面板中显示出来。

To see your model in Unity, simply drag it from the Project View into the Scene View or Hierarchy View.

只需要将你的模型简单的从工程面板拖拽到场景中或者层级面板下你就可在unity3d中查看你的模型。

Unity currently imports from Maya:
unity目前能从Maya导入:

  1. All nodes with position, rotation and scale. Pivot points and Names are also imported. 
    所有节点的位移,旋转,缩放,轴心和命名都将导入
  2. Meshes with vertex colors, normals and up to 2 UV sets. 
    网格模型包含顶点颜色,法线 以及两个以上的uv集。
  3. Materials with Texture and diffuse color. Multiple materials per mesh. 
    材质包含贴图以及漫反射颜色,以及单个网格的多维材质。
  4. Animations FK & IK 
    正向动力学(FK)和反向动力学(IK)动画。
  5. Bone-based animations 
    基本的骨骼动画

Unity does not import blend shapes. Use Bone-based animations instead. Unity automatically triangulates polygonal meshes when importing, thus there is no need to do this manually in Maya.

Unity不能直接导入融合变形(表情动画) ,可以使用基本骨骼动画来代替融合变形动画(注:可以使用maya AM插件导入融合变形)。Untiy导入多边形物体时会自动转换为三角形网格物体,如此一来就不必在maya中去手动处理多边形物体。

If you are using IK to animate characters you have to select the imported .mb file in Project View and choose Bake IK & Simulation in the Import Settings dialog in the Inspector.

如果你想使用反向动力学(ik)动画,那么你就必须在工程面板中选择你的.mb文件然后在检视面板的导入设置对话框中开启烘培ik和模拟。(注:也可以直接在maya中将ik动画,约束和控制器动画烘培到蒙皮骨骼上。)

Requirements 要求

In order to import Maya .mb and .ma files, you need to have Maya installed on the machine you are using Unity to import the .mb/.ma file. Maya 8.0 and up is supported.

如果你想直接导入.mb或者.ma文件,你必须在你的电脑中安装8.0以上版本的maya。

If you don't have Maya installed on your machine but want to import a Maya file from another machine, you can export to fbx format, which Unity imports natively. Please Install ->2011.3 for best results. To export see HOWTO_exportFBX.

如果你没有在你的电脑中安装maya程序,但又希望使用从其他电脑中制作的maya文件,那么你可以将文件输出为unity默认支持的fbx格式。请安装 2011.3.版本的fbx插件以获得做好的结果。更多详细设置请查看如何导出fbx格式文档。

Once exported Place the fbx file in the Unity project folder. Unity will now automatically import the fbx file. Check the FBX import setting in the inspector as mentioned in HOWTO_exportFBX

第一次将输出的fbx文件放置到unity的工程资源文件夹下,unity将自动导入fbx文件,在检视面板中查看fbx导入设置,更多详细内容请参考如何导出fbx格式文档。

Behind the import process (Advanced) 导入过程的背后(高级)

When Unity imports a Maya file it will launch Maya in the background. Unity then communicates with Maya to convert the .mb file into a format Unity can read. The first time you import a Maya file in Unity, Maya has to launch in a command line process, this can take around 20 seconds, but subsequent imports will be very quick.

当unity导入maya文件时会在后台启动maya。Unity将通过maya程序把.mb文件转换成unity可读取的格式(fbx格式)。当你第一次导入maya文件到unity的时候,maya将以命令行进程启动(maya*面启动模式),这可能需要20秒左右的时间。不过以后导入时会变得很快。

Troubleshooting 故障排除

  • Keep your scene simple, try and work with a file which only contains the objects you need in Unity 
    尽量保证你的场景简洁,努力将文件优化到只包含你在unity中所需要物体。(注:可以使用maya的优化场景命令来优化你的文件大小)
  • If your meshes cause problems, make sure you have converted any patches, nurbs surface etc into Polygons (Modify > Convert + also Mesh > Quadragulate/Triangulate) Unity only support Polygons. 
    如果你的网格模型发生错误,确认你是否将所有的patches和nurbs模型等转为多边形物体。(Modify > Convert + also Mesh > Quadragulate/Triangulate)unity仅支持多边形模型。
  • Maya in some rare cases messes up the node history, which sometimes results in models not exporting correctly. Fortunately you can very easily fix this by selecting Edit->Delete All by Type->History. 
    Maya在极少的情况下会因为历史节点的原因导致模型不能正确的输出,如果你遇到这样的问题,幸好有简单的办法可以对其进行修复。编Edit->Delete All by Type->History。
  • Unity likes to keep up with the latest FBX where possible so if you have any issues with importing some models, check Autodesk latest version, or for fail-safe install 2011.3
    Unity通常会保证支持最新版本的fbx插件。如果你在输出某些模型的时候遇到问题请检查你的fbx插件版本是否是最新版,或者至少安装2011.3版本的fbx插件避免出现输出错误。
  • Animation baking in Maya is now done with FBX instead of natively, which allows for more complex animations to be baked properly to FBX format. If you are using driven keys, then make sure to set at least one key on your drivers for the animation to bake properly 
    原来在maya中的动画烘培工作,现在可以用开启fbx自带的烘培选项这种简便的方法来代替,无论多么复杂的动画都可以轻松的使用fbx插件烘培输出,如果你使用了驱动关键帧技术请确保你的每一帧动画都被正确的烘培。

页面最后更新:2011-07-07