Meshes 网格
Meshes make up a large part of your 3D worlds. You don't build your meshes in Unity, but in another application.
网格组成您的3D世界很大一部分。你不在Unity建立网格,但在另一个应用程序中建立。
In Unity, we have done everything in our power to make this process as simple as possible. There are a lot of details, but the following pages should address all specificities of the common 3D art packages:
Unity,我们已完成所有事来使这个过程尽可能简单。有很多细节,但下面的页面应该解决所有常见的3D美术包的具体情况:
Other applications 其他应用程序
Unity can read .FBX, .dae (Collada), .3DS, .dxf and .obj files, so if your program can export to this format you're home free. FBX exporters for popular 3D packages can be found here. Many packages also have a Collada exporter available.
Unity可以读取来.FBX, .dae (Collada), .3DS, .dxf and .obj文件,所以如果你的程序可以导出到这种格式。流行的3D封装的FBX导出器可以在这里(here)找到。许多也封装有一个Collada导出器。
Textures 纹理
Unity will attempt to hook up materials to your imported scenes automatically. To take advantage of this, place your textures in a folder called "Textures" next to the scene file, or in any folder above it.
Unity将尝试将材质自动与你导入的场景挂钩。为了利用这一优势,放置您的纹理在场景文件旁被称为"Textures"文件夹中,或在它上面的任何文件夹一个文件夹。
Place your textures in a Textures folder at or above the asset's level
把你的纹理放到"Textures"文件夹中的以上的资源位置
Import settings. 导入设置
To access the Import Settings for a 3D mesh file, select it and the relevant options will appear in the Inspector.
要访问三维网格文件导入设置(Import Settings),选择该网格文件,相关的选项将出现在检视面板。
The Mesh Import Settings dialog 网格导入设置对话框
- Meshes 网格
- Scale Factor
缩放系数 Unity's physics system expects 1 meter in the game world to be 1 unit in the imported file. If you like to model at a different scale, this is the place to fix it.
Unity的物理系统,导入文件的1个单位预计在游戏的世界是1米。如果你想在塑造一个不同比例的模型,这是解决它的地方。 - Use File Units
使用文件单位 This option is available only for 3dsMax files. If enabled it imports 3dsMax file as 1FileUnit=1UnityUnit, otherwise it imports as 1cm=1UnityUnit.
此选项仅适用于3DSMAX文件。如果启用,以1FileUnit = 1UnityUnit 导入3DSMAX文件,否则以1厘米= 1UnityUnit导入。 - Mesh Compression
网格压缩 Turning this up will reduce the file size of the mesh, but might introduce irregularities. It's best to turn it up as high as possible without the mesh looking too different from the uncompressed version. This is useful for optimizing game size.
升高这值会降低网格的文件大小,但可能会导致谬误(模型走样变形)。最好是在与未经压缩网格的版本差异不会太大的前提下,将其设置得尽可能高。为优化游戏的大小(optimizing game size),这是有用的。 - Generate Colliders
产生碰撞 If this is enabled, your meshes will be imported with Mesh Colliders automatically attached. This is useful for quickly generating a collision mesh for environment geometry, but should be avoided for geometry you will be moving. For more info see Colliders below.
如果启用该选项,你的网格导入时,自动伴随着网格碰撞器(Mesh Colliders)一并导入。这对快速生成一个环境几何的碰撞网格是非常有用的,但应避免用在要移动的几何形状。欲了解更多信息,看下面的碰撞器(Colliders)。 - Swap UVs
交换Uv Use this if lightmapped objects pick up wrong UV channels. This will swap your primary and secondary UV channels.
如果被光线映射的物体接错了UV通道时使用。这将交换你的主要与次要UV通道。 - Generate Lightmap UVs
产生光照贴图Uv Use this to create UV2 to be used for Lightmapping.
用此为光照贴图(Lightmapping)创建UVs。 - Advanced Options 高级选项 See Lightmapping UVs document.
- Normals & Tangents 法线和切线
- Normals 法线 Defines if and how normals should be calculated. This is useful for optimizing game size.
定义是否和应如何计算法线。为优化游戏的大小(optimizing game size),这是有用的。 - Import 导入 Default option. Imports normals from the file.
默认选项。从文件导入法线。 - Calculate 计算 Calculates normals based on Smoothing angle. If selected, the Smoothing Angle becomes enabled.
根据平滑角度(Smoothing angle),计算法线。如果选中,启用平滑角度(Smoothing angle)。 - None 不使用 Disables normals. Use this option if the mesh is neither normal mapped nor affected by realtime lighting.
禁用法线。使用此选项,如果网格既没有法线贴图,也不受实时光照影响。 - Tangents 切线 Defines if and how tangents and binormals should be calculated. This is useful for optimizing game size.
定义是否和应如何计算切线和副法线。为优化游戏的大小(optimizing game size),这是有用的。 - Import 导入 Imports tangents and binormals from the file. This option is available only for FBX, Maya and 3dsMax files and only when normals are imported from the file.
从文件导入切线和副法线。此选项仅适用于FBX,Maya和3DSMAX文件,只有当法线从文件中导入时可用。 - Calculate 计算 Default option. Calculates tangents and binormals. This option is available only when normals are either imported or calculated.
默认选项。计算切线和副法线。只有当法线导入或计算,此选项可用。 - None 不使用 Disables tangents and binormals. The mesh will have no Tangents, so won't work with normal-mapped shaders.
禁用切线和副法线。网格没有切线,所以不能使用法线贴图着色器。 - Smoothing Angle 平滑角 Sets how sharp an edge has to be to be treated as a hard edge. It is also used to split normal map tangents.
设置如何对锋利的边缘作硬边处理。它也可以用来切分法线贴图切线。 - Split Tangents 分离切线 Enable this if normal map lighting is broken by seams on your mesh. This usually only applies to characters.
如果您的网格上的接缝破坏了法线贴图光照,启用这项。这通常只适用于角色。 - Materials 材质
- Generation 生成 Controls how materials are generated: 控制材质是如何生成的:
- Off 关闭 This will not generate materials at all. 这不会生成材质。
- Per Texture 根据纹理 Enable this to generate material files near the found texture files. When enabled, different scenes will share the same material settings when they use the same textures. For the precise rules, see Material Generation below.
启用此项,在找到的纹理文件旁生成材质文件。当启用时,当他们使用相同的纹理,不同的场景将共享相同的材质设置。精确的规则,看到下面的材质生成(Material Generation)。 - Per Material 根据材质 This will generate materials per scene, so only this scene uses them.
这将产生每个场景的材质,所以只有这一场景使用它们。 - Animations 动画
- Generation 生成 Controls how animations are imported: 控制如何导入动画:
- Don't Import 不导入 No animation or skinning is imported. 没有动画或蒙皮被导入。
- Store in Original Roots
存储在原始根对象中 Animations are stored in root objects of your animation package (these might be different from root objects in Unity).
动画存储在动画包的根对象(这些可能与Unity中的根对象不同)。 - Store in Nodes
存储在节点中 Animations are stored together with the objects they animate. Use this when you have a complex animation setup and want full scripting control.
动画与对象存储在一起。当你有一个复杂的动画设置,并希望完整的脚本控制时使用。 - Store in Root
存储在根对象中 Animations are stored in the scene's transform root objects. Use this when animating anything that has a hierarchy.
动画存储在场景的变换根对象。激活任何带有层级结构时使用。 - Bake Animations
烘焙动画 When using IK or simulation in your animation package, enable this. Unity will convert to FK on import. This option is available only for Maya, 3dsMax and Cinema4D files.
当使用IK或在动画包模拟,启用这个功能。Unity将其转换到FK导入。此选项仅适用于MAYA,3DSMAX和Cinema4D文件。 - Animation Wrap mode
动画循环模式 The default Wrap Mode for the animation in the mesh being imported
网格被导入时,动画默认的循环模式 - Split Animations
分割动画 If you have multiple animations in a single file, here you can split it into multiple clips.
如果你在一个文件中有多个动画,在这里你可以分割成多个剪辑。 - Name 名称 Name of the split animation clip 切分的动画剪辑名称
- Start 开始 First frame of this clip in the model file 在模型文件,这个剪辑的第一帧
- End 结束 Last frame of this clip in the model file 在模型文件,这个剪辑的最后一帧
- WrapMode 循环模式 What the split clip does when the end of the animation is reached
动画到达结束时,切割剪辑做什么? - Loop 循环 Depending on how the animation was created, one extra frame of animation may be required for the split clip to loop properly. If your looping animation doesn't look correct, try enabling this option.
根据动画是如何创建的,分割剪辑可能需要额外的动画帧以使可以正确的循环。如果你的循环动画看起来不正确,尝试启用此选项。 - Animation Compression 动画压缩
- Anim. Compression
动画压缩 What type of compression will be applied to this mesh's animation(s)
什么类型的压缩将被应用到这个网格的动画 - Off 关闭 Disables animation compression. This means that Unity doesn't reduce keyframe count on import, which leads to the highest precision animations, but slower performance and bigger file and runtime memory size. It's not recommended to use this option - if you need higher precision animation, you should enable keyframe reduction and lower allowed Animation Compression Error values instead.
禁用动画压缩。这意味着,Unity不减少导入关键帧的数量,导致精度最高的动画,但速度较慢的性能,更大的文件和运行时内存大小。不推荐使用这个选项 - 如果你需要更高的精度动画,您应该启用关键帧减少(keyframe reduction)和降低允许动画压缩误差值(Animation Compression Error)。 - Keyframe Reduction 关键帧减少 Reduces keyframes on import. If selected, the Animation Compression Errors options are displayed.
导入时减少关键帧。如果选中,动画压缩误差选项将会显示。 - Keyframe Reduction and
Compression
关键帧减少并压缩 Reduces keyframes on import and compresses keyframes when storing animations in files. This affects only file size - the runtime memory size is the same as Keyframe Reduction. If selected, the Animation Compression Errors options are displayed.
导入时减少关键帧和压缩动画存储在文件的关键帧。这仅会影响文件的大小 - 运行时内存大小与使用减少关键帧选项(Keyframe Reduction)时的是相同的。如果选中,动画压缩误差(Animation Compression Errors)选项将会显示。 - Animation Compression Errors
动画压缩误差 These options are available only when keyframe reduction is enabled.
这些选项仅当启用减少关键帧时可用。 - Rotation Error 旋转误差 Defines how much rotation curves should be reduced. The smaller value you use - the higher precision you get.
定义应该减少多少旋转曲线。值越小,精度越高。 - Position Error 位置误差 Defines how much position curves should be reduced. The smaller value you use - the higher precision you get.
定义应减少多少位置曲线。值越小,精度越高。 - Scale Error 缩放误差 Defines how much scale curves should be reduced. The smaller value you use - the higher precision you get.
定义应减少多少缩放曲线。值越小,精度越高。
Material Generation 材质生成
Materials are found based on the following rules:
材质是基于以下规则建立的:
- Unity gets the name of the main diffuse material bound to the objects in the scene.
Unity通过主漫反射材质的名称,把材质绑定到场景中的对象。 - Unity looks for a material with this name in a Folder called Materials next to the scene.
Unity在场景旁边的一个叫材质(Materials)的文件夹中找到叫这个名字的材质。 - Unity goes up the project folders, looking for the Material in each Materials folder along the way.
Unity在项目文件夹,一直往上在每个材质文件夹查找材质。
If Unity can't find the Material, it tries to create one from the texture:
如果Unity无法找到这个材质,它会尝试从纹理创建一个:
- Unity checks for a texture with the correct name in the same folder as the scene.
Unity在相同的文件夹中用正确的名字寻找纹理。 - Unity checks for a texture with the correct name in a folder called Textures next to the scene.
Unity在叫做纹理(Textures)的文件夹中用正确的名字寻找纹理。 - Unity goes up the project folders, looking for the correct texture in each Textures folder along the way.
Unity在项目文件夹一直向上查找,在材质(Textures)文件夹中寻找正确的纹理。 - If Unity finds the texture, it creates a Materials folder next to it and creates a material in there.
如果Unity找到这个纹理,它会在旁边创建了一个材质文件夹,并在那里创建一个材质。
Colliders 碰撞器
Unity features two primary types of colliders: Mesh Colliders and Primitive Colliders. Mesh colliders are components that use imported mesh data and can be used for environment collision. When you enable Generate Colliders in the Import Settings, a Mesh collider is automatically added when the mesh is added to the Scene. It will be considered solid as far as the physics system is concerned.
Unity碰撞器的两个主要类型:网格碰撞器和原始碰撞器。网格碰撞器组件,使用导入的网格数据,可用于环境碰撞。当您在生导入设置(Import Settings)中启用生成碰撞器(Generate Colliders),网格碰撞器在网格添加到场景中时自动添加。将被视为固体物理系统。
If you are moving the object around (a car for example), you can not use Mesh colliders. Instead, you will have to use Primitive colliders. In this case you should disable the Generate Colliders setting.
如果是移动的对象(例如汽车),你不能使用网格碰撞器。你将不得不使用原始碰撞器。在这种情况下,您应禁用生成碰撞器(Generate Colliders)设置。
Animations 动画
Animations are automatically imported from the scene. For more details about animation import options see the Animation Import chapter.
动画从场景自动导入。有关动画导入选项的更多细节,请参阅动画导入(Animation Import)章。
Normal mapping and characters 法线贴图 和 角色
If you have a character with a normal map that was generated from a high-polygon version of the model, you should import the game-quality version with a Smoothing angle of 180 degrees. This will prevent odd-looking seams in lighting due to tangent splitting. If the seams are still present with these settings, enable Split tangents across UV seams.
如果你有一个带法线贴图的人物,是从模型的高多边形版本生成的,你应该导入180度的平滑角度的游戏质量版本,。这将防止光照由于切线切割产生看起来很奇怪的接缝。如果这些设置仍然存在接缝,启用切分切线。
If you are converting a greyscale image into a normal map, you don't need to worry about this.
如果你是将灰度图像转换成一个法线贴图,你不必担心这个。
Hints 提示
- Merge your meshes together as much as possible. Make them share materials and textures. This has a huge performance benefit.
您的网格尽可能合并在一起。让他们分享材质和纹理。这有一个巨大的的性能优势。 - If you need to set up your objects further in Unity (adding physics, scripts or other coolness), save yourself a world of pain and name your objects properly in your 3D application. Working with lots of pCube17 or Box42-like objects is not fun.
如果您需要在Unity进一步建立对象(加入物理,脚本或其他),保存自己努力的世界,在您的3D应用程序的正确命名你的对象。 面对pCube17或Box42这样名字的对象是很没趣的。 - Make your meshes be centered on the world origin in your 3D app. This will make them easier to place in Unity.
使网格,在您的3D应用程序的世界原点居中,这将使得它们更容易被放置在Unity中。
The Unity Editor shows too many triangles (compared to what my 3D app says)
Unity编辑器显示了太多的三角形(比起我的3D应用程序)
This is correct. What you are looking at is the amount of triangles actually being sent to OpenGLES for rendering. In addition to case where something like the material requires them to be sent twice, other things like hard-normals and non contiguous UV increase vertex/triangle counts significantly compared to what a modeling app or Unity tells you. Triangles need to be contiguous in both 3D and UV space to form a strip, so when you have UV seams, degenerate triangles have to be made to form strips - this bumps up the count. Previously Unity would report triangle counts incorrectly. This was fixed first in the run-time, and recently in the Editor. Now both will report the correct amount of triangles *actually* being sent to OpenGLES for rendering.
这是正确的。你正在看到的是实际被发送到OpenGLES渲染的三角形数目。除了要求他们发送两次类似材质的情况下,其他事情像硬法线和非连续的UV,相比起建模软件增加顶点/三角形数量相比显着,或者Unity告诉你的。三角形需要连续的3D和UV空间,形成一个带状地带,所以当你有UV接缝,三角形要退回形成带状地带- 这会增加三角形的数量。Unity预先报告三角形计数不正确。这在运行时首先被修正,最近在编辑器中。现在,这两个报告*实际上*被送到OpenGLES渲染三角形的正确数目。
See Also 参见
- Modeling Optimized Characters 角色建模优化
- How do I use normal maps? 如何使用法线贴图?
- How do I fix the rotation of an imported model? 如何修复一个导入模型的旋转?