Version: 2021.2
网格过滤器 (Mesh Filter)
带蒙皮的网格渲染器 (Skinned Mesh Renderer)

网格渲染器 (Mesh Renderer)

网格渲染器从网格过滤器 (Mesh Filter) 获取几何体,然后在游戏对象的变换组件所定义的位置渲染该几何体。

The Mesh Renderer component as it appears in the Inspector window with Receive Global Illumination set to Light Probes.
The Mesh Renderer component as it appears in the Inspector window with Receive Global Illumination set to Light Probes.

本页包含以下部分:

材质

The Materials section in the Mesh Renderer Inspector lists all the Materials that the Mesh Renderer is using. Meshes imported from 3D modelling software can use multiple Materials, and each sub-Mesh uses one Material from the list.

If a Mesh contains more Materials than sub-Meshes, Unity renders the last sub-Mesh with each of the remaining Materials, one on top of the next. This allows you to set up multi-pass rendering on that sub-Mesh. However, this can impact the performance at run time. Fully opaque Materials overwrite the previous layers, which causes a decrease in performance with no advantage.

属性: 功能:
Size Specify the number of Materials in the Mesh Renderer. If you decrease the size of the list of Materials, Unity deletes the elements at the end of the list.
Element A list of the Materials in the Mesh Renderer, in numeric order. The first element is always named Element 0.

光照

The Lighting section contains properties for how this Mesh Renderer interacts with lighting in Unity.

属性: 功能:
Cast Shadows 指定在合适的光源照射在网格上时网格是否以及如何投射阴影。
On 阴影投射的光源照在网格上时,网格将投射阴影。
Off 网格不会投射阴影。
Two Sided The Mesh casts shadows from either side. For Enlighten Realtime and Baked Illumination and the Progressive Lightmapper to support two-sided shadows, the Material assigned to the target renderer must support Double Sided Global Illumination.
Shadows Only 网格的阴影可见,但网格本身不可见。
Receive Shadows 启用此选项可使网格显示任何投射在网格上的阴影。仅当使用渐进光照贴图时才支持这个选项。
Contribute Global Illumination Select this property to enable the Contribute GI flag in the GameObject’s Static Editor Flags. This property includes this GameObject’s Mesh Renderer in global illumination calculations. These calculations take place while precomputing lighting data at bake time. This property only takes effect if you enable a Global Illumination setting such as Baked Global Illumination or Enlighten Realtime Global Illumination for this Scene. This property enables Receive Global Illumination options.
Receive Global Illumination Select an option to determine whether Unity gathers global illumination data for this GameObject’s Mesh Renderer from lightmaps or Light Probes at runtime. This selection does not directly affect precomputation. However, when you choose the Light Probes option, Unity does not calculate lightmaps for the Renderer during precomputation, which can significantly reduce bake times. This property is only editable if you enable Contribute Global Illumination.

If Contribute Global Illumination is disabled, Receive Global Illumination defaults to the Light Probes setting. This property only takes effect if you enable a Global Illumination setting such as Baked Global Illumination or Enlighten Realtime Global Illumination for this Scene.
Lightmaps 如果 Unity 应从光照贴图为此网格渲染器收集全局光照数据,请选择此选项。
光照探针 如果 Unity 应在此场景中从光照探针为此网格渲染器收集全局光照数据,请选择此选项。
Prioritize illumination Enable this property to always include this GameObject in Enlighten Realtime Global Illumination calculations. It ensures that the GameObject is affected by distant emissives, even those which are normally excluded from Global Illumination calculations for performance reasons."

This property is visible only if Contribute GI is enabled in the GameObject’s Static Editor Flags, your Project uses the Built-in Render Pipeline, and Enlighten Realtime Global Illumination is enabled in your Scene.

Lightmapping

This section is visible only if only if Receive Global Illumination is set to Lightmaps.

属性: 功能:
Scale in Lightmap 指定游戏对象的 UV 在光照贴图中的相对大小。值为 0 会使游戏对象不进行光照贴图,但仍然有助于为场景中的其他游戏对象提供光照。大于 1.0 的值会增加用于此游戏对象的像素数(光照贴图分辨率),而小于 1.0 的值会减小该像素数。

您可以使用此属性来优化光照贴图,从而更精确地为重要和高度细节化的区域提供光照。例如:一幢具有平坦黑暗墙壁的隔离建筑物将使用低光照贴图比例(小于 1.0),而一组靠近在一起显示的彩色摩托车则需要高比例值。
Stitch Seams 如果启用此参数,光照贴图程序将识别应缝合在一起的成对边缘,并在接缝处产生尽可能顺畅的光能传递。此参数仅适用于沿图集中的图表边界水平或垂直延伸的直边。按设计,此参数可用于在 UV 空间中采用轴对齐的矩形。
Lightmap Parameters 为此游戏对象选择或创建光照贴图参数资源。
Optimize Realtime UVs Specify whether the authored Mesh UVs are optimized for Enlighten Realtime Global Illumination or not. When enabled, Unity merges, scales and packs the authored UVs for optimization purposes.

When disabled, Unity scales and packs, but does not merge, the authored UVs.

The optimization sometimes makes mistakes about discontinuities in the original UV mapping. For example, an intentionally sharp edge may be misinterpreted as a continuous surface.

This property is visible only if your Project uses the Built-in Render Pipeline, and Enlighten Realtime Global Illumination is enabled in your Scene.
Max Distance Specify the maximum worldspace distance to be used for UV chart simplification. If charts are within this distance, Unity simplifies them.

This property is visible only if your Project uses the Built-in Render Pipeline, and Enlighten Realtime Global Illumination is enabled in your Scene.
Max Angle Specify the maximum angle in degrees between faces sharing a UV edge. If the angle between the faces is below this value, Unity simplifies the UV charts.

This property is visible only if your Project uses the Built-in Render Pipeline, and Enlighten Realtime Global Illumination is enabled in your Scene.
Ignore Normals Enable this option to prevent Unity from splitting the UV charts during the precompute process for Enlighten Realtime Global Illumination lighting.

This property is visible only if your Project uses the Built-in Render Pipeline, and Enlighten Realtime Global Illumination is enabled in your Scene.
Min Chart Size Specify the minimum texel size used for a UV chart. If stitching is required, a value of 4 creates a chart of 4x4 texels to store lighting and directionality. If stitching is not required, a value of 2 reduces the texel density and provides better lighting build times and game performance.

This property is visible only if your Project uses the Built-in Render Pipeline, and Enlighten Realtime Global Illumination is enabled in your Scene.

烘焙光照数据(菜单:Window > Rendering > Lighting > Generate Lighting)后,此部分还将显示这个渲染器在场景中使用的光照贴图。在此处可以查看有关烘焙光照贴图 (Baked Lightmap) 和实时光照贴图 (Realtime Lightmap) 的相关信息(如果适用)。

进行烘焙后在场景中显示的光照贴图示例。
进行烘焙后在场景中显示的光照贴图示例。

Probes

Probes 部分包含与光照探针 (Light Probes) 和反射探针 (Reflection Probes) 有关的属性。

属性 功能
Light Probes 设置此渲染器如何从光照探针系统接收光照。

有关更多信息,请参阅光照探针
Off 渲染器不使用任何插值光照探针。
Blend Probes 渲染器使用一个插值光照探针。这是默认值。
Use Proxy Volume 渲染器使用插值光照探针的 3D 网格。
Custom Provided 渲染器从 MaterialPropertyBlock 提取光照探针着色器 uniform 值。
Proxy Volume Override 设置对另一个具有 Light Probe Proxy Volume 组件的游戏对象的引用。

仅当 Light Probes 设置为 Use Proxy Volume 时,此属性才可见。
Reflection Probes 设置渲染器如何从反射探针系统接收反射。
Off 禁用反射探针。Unity 将天空盒用于反射。
Blend Probes 启用反射探针。混合仅在反射探针之间发生。在室内环境中,如果角色可能在具有不同光照设置的区域之间过渡,此设置会很有用。
Blend Probes and Skybox 启用反射探针。混合发生在反射探针之间或反射探针与默认反射之间。这对于室外环境很有用。
Simple 启用反射探针,但存在两个重叠的探针体积时,反射探针之间不会发生混合。
Anchor Override 设置变换组件,在使用光照探针反射探针系统时由 Unity 用来确定插值位置。默认情况下,这个位置是渲染器几何体的包围盒中心。

Additional Settings

Additional Settings 包含额外的属性。

属性 功能
Motion Vectors 设置是否使用运动矢量来跟踪此渲染器从一帧到下一帧的每像素屏幕空间运动。使用此信息可以应用后期处理效果,例如运动模糊。

请注意,并非所有平台都支持运动矢量。请参阅 SystemInfo.supportsMotionVectors 以了解更多信息。
Camera Motion Only 仅使用摄像机移动来跟踪运动。
Per Object Motion 使用特定通道来跟踪此渲染器的运动。
Force No Motion 不跟踪运动。
Dynamic Occlusion 启用 Dynamic Occlusion 后,线渲染器在摄像机的视图中被静态渲染器 (Static Occluder) 阻挡时,Unity 会剔除线渲染器。默认情况下启用 Dynamic Occlusion。

禁用 Dynamic Occlusion 后,线渲染器在摄像机的视图中被静态渲染器 (Static Occluder) 阻挡时,Unity 不剔除线渲染器。禁用 Dynamic Occlusion 可以实现诸如在墙后绘制角色轮廓之类的效果。

请参阅有关遮挡剔除的文档以了解更多信息。
网格过滤器 (Mesh Filter)
带蒙皮的网格渲染器 (Skinned Mesh Renderer)