查看: 4631|回复: 0
打印 上一主题 下一主题

[Unity 组件参考手册]组件:资源组件之网格Meshes

[复制链接]
.    

3797

主题

11

听众

5万

积分

首席设计师

Rank: 8Rank: 8

纳金币
32328
精华
41

活跃会员 优秀版主 荣誉管理 论坛元老

跳转到指定楼层
楼主
发表于 2013-1-24 20:57:52 |只看该作者 |倒序浏览
Meshes make up a large part of your 3D worlds. Unity doesn't have its own tools for mesh creation but has good interactivity with popular 3D modelling software. Importing meshes is mostly straightforward but the following pages note things that you need to watch out for with particular applications.
网格组成您的3D世界很大的一部分。Unity没有创建网格的工具,但是Unity与有普遍流行的3D建模软件很好的交互性。导入模型是一件很简单的事,但以下页面记录了一些你需要注意的事情。
    maya

    Cinema 4D

    3ds max

    Cheetah3D

    Modo

    Lightwave

    Blender
[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格式的文件,因此所有可以导出这些格式的软件都适用于Unity。流行的FBX导出器可以在这里(here)找到。许多3d软件也封装有一个Collada导出器。


[Textures 纹理]
Unity will attempt to find the textures used by a mesh automatically on import by following a specific search plan. First, the importer will look for a sub-folder called Textures within the same folder as the mesh or in any parent folder. If this fails, an exhaustive search of all textures in the project will be carried out. Although slightly slower, the main disadvantage of the exhaustive search is that there could be two or more textures in the project with the same name. In this case, it is not guaranteed that the right one will be found.
Unity会根据下述寻找贴图的方案来尝试自动的导入与网格相关的贴图。首先,贴图导入器会寻找与网格在同级或上级文件夹下的Textures子文件夹。如果这样的查找失败了,导入器将会对项目中所有的贴图进行穷举搜索。穷举搜索较慢,并且如果当有两个或多个同名的贴图时,穷举搜索不能保证能找到正确的贴图,这是穷举搜索最主要的缺点。

Place your textures in a Textures folder at or above the asset's level

把你的纹理放到与资源文件同级或上级的Textures文件夹中


[Import settings. 导入设置]
The Import Settings for a mesh file will be displayed in the inspector when the mesh is selected.
当网格被选中时,网格的导入设置会显示在检视面板中。


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 prefer to model at a different scale then you can compensate for it here.

    Unity的物理系统希望游戏世界中的1米为导入文件中的1单位。调整此参数可以塑造一个不同比例的模型

   
Use File Units 使用文件单位

    This option is available only for 3dsmax files. If enabled it imports 3dsMax file with one Max unit equal to one Unity unit, otherwise it imports with 1 cm equal to 1 Unity unit.

    此选项仅适用于3dsMax文件。如果启用此选项,以1Max单位 = 1Unity单位导入3DSMAX文件,否则以1厘米= 1Unity单位导入


Mesh Compression 网格压缩

    Increasing this value 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)是有用的。

    Mesh Optimization 网格优化

    This option determines the order in which triangles will be listed in the mesh.

    此选项决定了以何种顺序将三角形排列在网格中

   
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.

    如果启用该选项,网格导入时会自动生成其网格碰撞体。这对快速生成一个环境几何体的碰撞网格是非常有用的,但应避免将其用在要移动的几何体上。欲了解更多信息,请看看下面的碰撞体(Colliders)。

   
Swap UVs 交换Uv

    Use this if lightmapped objects pick up the wrong UV channels. This will swap your primary and secondary UV channels.

    当有光照贴图的物体的UV通道不正确时启用此选项。这将交换你的主UV通道与次UV通道。

   
Generate Lightmap UVs 产生光照贴图UV

    Use this to create the second UV channel to be used for Lightmapping.

    启用此选项会为光照贴图创建第二个UV通道。

        
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 in order 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 材质]

Import Materials 导入材质

    Disable this if you don't want materials to be generated. Default-Diffuse material will be used instead.

    如果您不想Unity为您生成材质,禁用此选项。禁用此选项后,所有的材质都为默认的漫反射材质

   
Material Naming 材质命名

    Controls how Unity materials are named:

    此选项决定了Unity材质的命名方式:

        <textureName>.mat

        <贴图名>.mat

    The name of the diffuse texture of the imported material that will be used to name the material in Unity. When a diffuse texture is not assigned to the material, Unity will use the name of the imported material.

    Unity材质以导入材质中的漫反射贴图的名字来命名。如果材质中没有漫反射贴图,Unity会用导入的材质的名字来对材质进行命名

        
<materialName>.mat  <材质名>.mat

    The name of the imported material will be used for naming the Unity material.

    Unity材质以导入材质的名字来命名

      
<modelFileName>-<materialName>.mat  <模型文件名>-<材质名>.mat

    The name of the model file in combination with the name of the imported material will be used for naming the Unity material.

    Unity材质以模型名和导入材质的名字来命名

        
<textureName>.mat or <modelFileName>-<materialName>.mat (OBSOLETE)

<贴图名>.mat或<模型文件名>-<材质名>.mat(已过时)

    The name of the diffuse texture of the imported material will be used for naming the Unity material. When a diffuse texture is not assigned or it cannot be located in one of the Textures folders, then the material will be named <modelFileName>-<materialName>.mat instead. This option is backwards compatible with the behavior of Unity 3.4 (and earlier versions). We recommend using <textureName>.mat, because it is less complicated and has more consistent behavior.

    Unity材质以导入材质中的漫反射贴图的名字来命名,如果材质中没有漫反射贴图或没有在Textures文件夹中找到此贴图,Unity材质将会按<模型文件名>-<材质名>.mat来命名。此选项用于对Unity3.4(及更早的版本)进行向后兼容。我们推荐您使用<贴图名>.mat,<贴图名>.mat比较简单且有更一致的行为。

   
Material Search 材质搜索

    Controls where Unity will try to locate existing materials using the name defined by the Material Naming option:

    决定Unity如何根据材质命名选项中定义的名字查找已有的材质

        
Local 本地

    Unity will try to find existing materials only in the "local" Materials folder, ie, the Materials subfolder which is the same folder as the model file.

    Unity只会在本地的Materials文件夹中查找已有的材质,即,与模型文件在同一文件夹下的Materials子文件夹

        
Recursive-Up 向上递归

    Unity will try to find existing materials in all Materials subfolders in all parent folders up to the Assets folder.

    Unity会在所有的父文件夹中的Materials子文件夹中查找已有的材质

        
Everywhere 所有地方

    Unity will try to find existing materials in all Unity project folders.

    Unity会在所有的项目文件夹下查找已有的材质

   
[Animations 动画]

Generation 生成

    Controls how animations are imported: 控制如何导入动画:

        
Don't Import 不导入

    No animation or skinning is imported. 不导入动画或蒙皮。

        S
store in Original Roots 存储在原始根对象中

    Animations are stored in the root objects of your animation package (these might be different from the 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 烘焙动画

    Enable this when using IK or simulation in your animation package. Unity will convert to forward kinematics on import. This option is available only for Maya, 3dsMax and cinema4d files.

    当在动画包中使用IK或模拟时,启用此功能。Unity在导入时会转换为前向运动学。此选项仅适用于MAYA,3DSMAX和Cinema4D文件。

   
Animation Wrap mode 动画循环模式

    The default Wrap Mode for the animation in the mesh being imported

    网格被导入时,动画默认的循环模式

        
Default 默认

    The animation plays as specified in the animation splitting options below.

    根据动画分割选项内容播放动画

        
Once 一次

    The animation plays through to the end once and then stops.

    动画播放完毕后停止

        
Loop 循环

    The animation plays through and then restarts when the end is reached.

    动画播放完毕后重复播放

        
PingPong 乒乓

    The animation plays through and then plays in reverse from the end to the start, and so on.

    动画播放完毕后反向播放动画

        
ClampForever 永久钳制

    The animation plays through but the last frame is repeated indefinitely. This is not the same as Once mode because playback does not technically stop at the last frame (which is useful when blending animations).

    动画播放完毕后重复动画的最后一帧。此模式与单次循环模式不同,因为在播放技术上不一定停在最后一帧(这在动画融合时很有用)。

   
Split Animations 分割动画

    If you have multiple animations in a single file, you can split it into multiple clips.

    如果一个文件中有多个动画,可以用此功能将其分割为多个片段。

        
Name 名称

    The name of the split animation clip 分割得到的动画片段的名称

        
Start 开始

    The first frame of this clip in the model file在模型文件中,此片段的第一帧

        
End 结束

    The last frame of this clip in the model file在模型文件中,此片段的最后一帧

        
WrapMode 循环模式

    What the split clip does when the end of the animation is reached (this is identical to the wrap mode option described above).

    动画片段播放结束时的行为(与前面提到的动画循环模式一样)

        
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 动画压缩

    The type of compression that 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 ***ntime memory size. It is generally not advisable 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.

    导入时减少关键帧。选用此模式会显示动画压缩误差(Animation Compression Error)选项

        
Keyframe Reduction and Compression 关键帧减少并压缩

    Reduces keyframes on import and compresses keyframes when storing animations in files. This affects only file size - the ***ntime memory size is the same as Keyframe Reduction. If selected, the Animation Compression Errors options are displayed.

    导入时减少关键帧并在存储文件时压缩关键帧。此模式只会影响文件大小 – 运行时内存大小与使用关键帧减小模式时相同。选用此模式会显示动画压缩误差(Animation Compression Error)选项

   
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 and Assignment 材质生成和赋值]
For each imported material Unity will apply the following ***les:-
对每个导入的材质,Unity会使用下列规则:
If material generation is disabled (i.e. Import Materials is unchecked), then it will assign the Default-Diffuse material. If it is enabled then it will do the following:
如果禁用了材质生成(即禁用了导入材质选项),所有的材质都被赋为默认的漫反射材质。如果启用了材质生成,那么将按照以下的规则对材质进行赋值:
    Unity will pick a name for the Unity material based on the Material Naming setting

    根据材质命名(Material Naming)设置为Unity材质命名

    Unity will try to find an existing material with that name. The scope of the Material search is defined by the Material Search setting.

    在已有的材质中寻找具有相同名字的材质。材质搜索(Material Search)设置决定了材质搜索的范围

    If Unity succeeds in finding an existing material then it will use it for the imported scene, otherwise it will generate a new material

    如果Unity成功的找到了具有相同名字的材质就会将此材质赋给导入的场景,否则将会为其生成新的材质

Colliders 碰撞器
Unity uses two main 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有两种类型的碰撞体:网格碰撞体(Mesh Colliders)和原始碰撞体(Primitive Colliders)。网格碰撞体组件使用导入的网格数据,可用于环境碰撞。如果在导入设置中启用了生成碰撞体(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.
网格碰撞体不能用于会移动的对象(如汽车)。在这种情况下,只能使用原始碰撞体并应禁用生成碰撞体选项。


Animations 动画
Animations are automatically imported from the scene. For more details about animation import options see the Animation Import chapter.
动画从场景中自动导入。有关动画导入选项的更多细节,请参阅动画导入章节。


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度的平滑角度(Smoothing angel)导入此角色的游戏质量版本。这将防止由于切线切割在光照中产生的奇怪的接缝。如果在应用了这些设置后仍然存在接缝,启用在UV接缝处分割切线选项(Split tangents across UV seams)。
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 number of triangles actually being sent to OpenGLES for rendering. In addition to the case where the material requires them to be sent twice, other things like hard-normals and non-contiguous UVs 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 ***n-time, and recently in the Editor. Now both will report the correct number of triangles actually being sent to OpenGLES for rendering.
这是正确的。你看到的是实际被发送到OpenGLES渲染的三角形数目。除了有的材质需要将三角形发送两次的情况下,其他事情,如硬法线和非连续的UV,显著地增加了顶点/三角形数量,相比起建模软件或者Unity告诉你的。三角形需要连续的3D和UV空间才能形成一个strip,所以当模型中有UV接缝时,需要创建退化的三角形来形成strip - 这会增加三角形的数量。以前版本的Unity会报告三角形计数不正确。这首先在运行时被修正,最近在编辑器中也被修正了。现在,运行时和编辑器都能报告实际上被送到OpenGLES渲染的三角形的正确数目。
【来源:互联网】

更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-11-15 17:35 , Processed in 0.491896 second(s), 32 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部