Distance Shadowmask__是 Shadowmask(阴影遮罩)__光照模式的一个版本。该模式由场景中的所有混合光源共用。要将 Mixed lighting 设置为 __Distance Shadowmask__,请执行以下操作:
请参阅混合光照相关文档以了解有关此光照模式的更多信息,并参阅光照模式相关文档以了解有关其他可用模式的更多信息。
阴影遮罩是一种纹理,它与相应的光照贴图共享相同的 UV 布局和分辨率。它存储每个纹理像素的最多 4 个光源的遮挡信息,因为纹理在当前 GPU 上限制为最多 4 个通道。
Distance Shadowmask 模式是 Shadowmask 光照模式的一个版本,可提供从静态游戏对象投射到动态游戏对象的高质量阴影。
在__阴影距离 (Shadow Distance)(菜单:__Edit > Project Settings__,然后选择 Quality__ 类别,并导航到 Shadows 部分)内,Unity 会将动态和静态游戏对象渲染到阴影贴图中,可让静态游戏对象将清晰的阴影投射到动态游戏对象上。基于此原因,__Distance Shadowmask__ 模式相对于 Shadowmask 模式具有更高的性能要求,因为场景中的所有静态游戏对象都将渲染到阴影贴图中。
超出__阴影距离__:
适合使用 Distance Shadowmask 模式的一个很好的例子是,您想要构建一个开放的世界场景,其中的阴影延伸到地平线,复杂的静态网格在移动的角色上投射实时阴影。
下表显示了使用 Distance Shadowmask 模式时静态和动态游戏对象如何投射和接受阴影:
动态阴影接受者 从另一个静态或动态游戏对象接受阴影的动态游戏对象 |
静态阴影接受者 从另一个静态或动态游戏对象接受阴影的静态游戏对象 |
|||
---|---|---|---|---|
在阴影距离内 | 超出阴影距离 | 在阴影距离内 | 超出阴影距离 | |
动态阴影投射物 投射阴影的动态游戏对象 |
阴影贴图 | - | 阴影贴图 | - |
静态阴影投射物 投射阴影的静态游戏对象 |
阴影贴图 | 光照探针 | 阴影贴图 | 阴影遮罩 |
鉴于 Distance Shadowmask 模式的性能要求,该模式非常适合以高端 PC 和最新款游戏主机为目标的构建。Distance Shadowmask 模式最主要的优缺点如下:
2017–09–18 页面已发布并只进行了有限的编辑审查
在 5.6 版中添加了“光照模式”
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.