Where to Start? 如何开始
本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于Unity2018.3版本
翻译中有些术语不准确,但不影响理解的,不再一一调整,请谅解。
参考链接:https://unity3d.com/cn/learn/tutorials/projects/creating-believable-visuals/where-start?playlist=17102
Before we start to explore rendering inside Unity, we first need to get our assets into a format suitable for our eventual intent. Setting up a proper workflow from your Digital Content Creation tool into Unity is critical. While we won’t go through the export steps in the multitude of DCC tools available, there are a few things that we need to consider:
在我们开始探索Unity内部渲染之前,我们首先需要将我们的资产转换成适合我们最终意图的格式。建立一个正确的工作流程,从您的数字内容创建工具到Unity是至关重要的。虽然我们不会在众多可用的DCC工具中进行导出步骤,但是我们需要考虑以下几点:
Scale and units
缩放和单位
Scale and your unit of measurement play a very important role in a believable scene. In many “real world” setups, it is recommended to assume 1 Unity unit = 1 meter (100cm) as many physics systems assume this unit size.
缩放和你的单位在一个可信的场景中扮演着非常重要的角色。在许多“真实世界”设置中,建议假设1个单位= 1米(100厘米),因为许多物理系统都假设这个单位的大小。
Unit translation DCC 3D software to Unity
DCC三维软件到Unity的单位传递
To maintain consistencies between DCC 3D software and Unity it’s always a good idea to validate imported object scale and size. DCC 3D software such as 3ds Max/Maya/Blender/Houdini,etc have units settings and have scale settings in the FBX export configuration (consult each software manual to configure). In general setting these tools to work in cm and export FBX at automatic scale will match the scale in Unity import properly. However it’s always reassuring to confirm it matches whenever starting a project.
为了保持DCC 3D软件和Unity之间的一致性,验证导入对象的缩放和大小总是一个好主意。DCC 3D软件,如3ds Max/Maya/Blender/Houdini等,在FBX导出配置中有单元设置和缩放设置(请参阅每个软件手册进行配置)。一般情况下,将这些工具设置为在cm中工作,并自动按比例导出FBX,将与在Unity导入中正确匹配。然而,无论什么时候开始一个项目,确认它匹配总是令人放心的。
A quick test to validate your export settings would be to create a simple 1x1x1m cube in your DCC 3D software. This can then be imported into Unity. The default Unity Cube (GameObject > 3D Object > Cube) is 1x1x1m and is therefore a useful scale reference to compare with your imported model.
验证导出设置的一个快速测试是在DCC 3D软件中创建一个简单的1x1x1m立方体。然后可以导入到Unity中。默认的Unity Cube (GameObject > 3D Object > Cube)是1x1x1m,因此是与导入模型进行比较的一个有用的比例尺参考。
These cubes should look identical when scale is set to 1,1,1 in the Transform component within the Unity Inspector.
在Unity检查器的Transform组件中将scale设置为1,1,1时,这些立方体看起来应该是相同的。
NOTES: - Maya and 3DsMax can override your default unit depending on the last opened file. - Be aware that 3D Software can display different unit in the workspace while having different settings in their “internal unit”. This might cause some confusion.
注:- Maya和3DsMax可以覆盖您的默认单位取决于最后打开的文件。-请注意,3D软件可以显示不同的单位在工作空间,而有不同的设置在他们的“内部单位”。这可能会引起一些混乱。
Shown example is from 3ds Max. 显示的例子来自3ds Max。
Point of reference scale model.
参考点比例尺模型
When blocking out a Scene with placeholders or sketching geometry, having a point of reference scale model can be helpful. Depending on what Scene you’re making, choose a point of reference scale model that is relatable for the Scene. In the Spotlight Tunnel Sample Scene case, a common park bench was chosen. This doesn’t mean the Scene has to be exactly the same proportions as real life, instead it allows consistencies of scale to be relative between objects even if the Scene is intended to have exaggerated proportions.
当用图片框或几何草图勾勒出一个场景时,有一个参考点比例模型是很有帮助的。根据场景的不同,选择一个与场景相关的参考比例尺模型。在聚焦隧道样例场景案例中,选择了一个普通的公园长椅。这并不意味着场景必须与现实生活中的比例完全相同,相反,它允许物体之间的比例一致性,即使场景想要夸大比例。
Texture output and channels
纹理输出与通道
In the same way that Unity expects consistent unit translation between 3D software and Unity, the information inside a texture needs to contain the correct information to give a proper result when added to a material.
就像Unity希望在3D软件和Unity之间实现一致的单元转换一样,纹理内部的信息也需要包含正确的信息,以便在添加到材质时得到正确的结果。
Example of presets configuration for Substance Painter to output textures to be used with Unity Standard Opaque material.
以下为Substance Painter 的预设配置的例子,以输出纹理供Unity 标准不透明材质使用。
Texture assignment in Unity Standard Material:
在Unity标准材质中的纹理赋值:
- $textureSet_Albedo: assigned to Albedo Slot. 赋值给Albedo
- $textureSet_MetallicAOGloss: assigned to Metallic and Occlusion, smoothness Source set to Metallic Alpha.
赋值给金属和遮挡,平滑度设置为金属纹理的Alpha通道 - $textureSet_Normal: assigned to Normal Map Slot. 赋值给法线
NOTE: Packing multiple channels to a single texture such as the Metallic, AO, Gloss saves texture memory compared to exporting Ambient Occlusion (AO) as separate texture. This is the typical way of working with Unity Standard material.
注意:与将环境遮挡(AO)作为单独纹理导出相比,将多个通道打包到单个纹理(如metal, AO, Gloss)可以节省纹理内存。这是使用Unity标准材质的典型方法。
Texture authoring software such as Photoshop and Substance Painter will output consistent and predictable textures with proper configuration. There are however some cases where content creators can get mixed up mainly dealing with alpha channel.
纹理创作软件,如Photoshop和Substance Painter将输出一致和可预测的纹理与适当的配置。然而,在某些情况下,内容创建者可能主要在处理alpha通道会混淆。
The example below shows “transparency” in a PNG can be confusing to author in Photoshop because of its native way in dealing with PNG Alpha without external plugin. In this case an uncompressed 32 Bits TGA with a dedicated Alpha Channel might be a better option, assuming source texture file size is not an issue.
下面的例子展示了PNG中的“透明度”,对于Photoshop中的作者来说可能会感到困惑,因为PNG Alpha在没有外部插件的情况下使用的是原生方式。在这种情况下,带有专用Alpha通道的未压缩32位TGA可能是更好的选择,假设源纹理文件大小不是问题。
Photoshop authored “transparent” PNG above has alpha coming through as a black value, while the TGA with dedicated Alpha Channel shows expected value. When each texture assigned to Standard material that reads alpha channel as smoothness, the result is the unexpectedly inverted smoothness in the material with PNG textures while the material with TGA texture displays expected results as shown above.
上面Photoshop中创建的“透明”PNG的alpha值是黑色的,而带有专用alpha通道的TGA显示的是期望值。当将每个纹理赋值给标准材质时alpha通道作为平滑度时,结果是PNG纹理的材质出乎意料地倒转了平滑度,而TGA纹理的材质显示了预期的结果,如上所示。
Normal map direction.
法线贴图的方向
Unity reads tangent space normal maps with the following interpretation: Red channel X+ as “Right”, Green channel Y+ as “Up”(OpenGL style).
Unity读取切线空间法线贴图的解释如下:红色通道X+表示“右”,绿色通道Y+表示“上”(OpenGL样式)。
For example, 3ds Max “Render to Texture” normal map output Green Channel Y+ as “Down” by default. This will cause inverted surface direction along the Y axis and create invalid results when lit.
例如,3ds Max“渲染到纹理”法线贴图输出绿色通道Y+默认为“向下”。这将导致沿Y轴反向的表面方向,并在光照时创建无效的结果。
To validate normal map direction, create a simple plane with concave bevel (middle picture on the example above) and bake it to a flat plane. Then assigned the baked normal map into a plane in Unity with identifiable light direction and see if any of the axis are inverted. Refer to your Digital Content Creation software manual for proper axis settings.
要验证法线贴图的方向,可以创建一个带有凹形坡口的简单平面(上面例子中的中间图片),并将其烘焙到一平面。然后将烘焙好的法线贴图分配到Unity中一个与可识别的光方向的平面上,看是否有任何轴是倒置的。有关正确的axis设置,请参阅您的数字内容创建软件手册。