本页介绍在场景使用的 Lighting Settings Asset 的 Lighting Mode 属性设置为 Shadowmask 时,该场景中所有混合光源的行为。
Similar to Baked Indirect Lighting Mode, Shadowmask Lighting Mode combines real-time direct lighting with baked indirect lighting. However, Shadowmask Lighting Mode differs from Baked Indirect Lighting Mode in the way that it renders shadows. Shadowmask Lighting Mode allows Unity to combine baked and real-time shadows at runtime, and to render shadows in the far distance. It does this by using an additional lightmap Texture known as a shadow mask, and by storing additional information in Light Probes.
Shadowmask 光照模式在所有光照模式中提供最高保真度的阴影,但需要的性能成本和内存要求也是最高的。此模式适用于在高端或中档硬件上渲染远处游戏对象可见时的真实场景,例如空旷的空间世界。
See render pipeline feature comparison for more information about support for Shadowmask Lighting Mode across render pipelines.
Shadowmask 光照模式有以下质量设置:
将场景的 Lighting Mode 设置为 Shadowmask 并且项目使用 Distance Shadowmask 质量设置时,混合光源的行为如下。
将场景的 Lighting Mode 设置为 Shadowmask 并且项目使用 Shadowmask 质量设置时,混合光源的行为如下。
在内置渲染管线中:
在 HDRP 中:
按照 HDRP Shadowmask 光照模式文档中的说明进行操作。
可以使用 Shadow Distance 属性来限制 Unity 绘制实时阴影的最大距离。
在运行时,Unity 使用阴影遮罩来确定某个像素是否在阴影中。阴影遮罩纹理包含有关烘焙光源的遮挡信息。该纹理与相应的光照贴图共享相同的 UV 布局和分辨率。还针对每个纹素包含最多四个光源的遮挡信息(以 RGBA 格式存储)。
如果超过四个光源发生重叠,则多余光源会回退至烘焙光照 (Baked Lighting)。烘焙系统会决定哪个光源回退至烘焙光照,并在各烘焙之间保持一致,除非您修改其中某个重叠的光源。光照探针也会接收最多四个光源的相同信息。
Unity 将独立于接收阴影的对象来计算光源重叠。因此,一个对象可受到全部来自同一个阴影遮罩/探针通道的十个不同混合光源的影响,只要这些光照包围体在空间中的任何点都不重叠即可。如果某些光源重叠,则 Unity 会使用更多通道。如果某个光源确实发生重叠而所有四个通道都在使用中,则该光源将回退至完全烘焙。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.