本页介绍在场景使用的 Lighting Settings Asset 的 Lighting Mode 属性设置为 Baked Indirect 时,该场景中所有混合光源的行为。
将场景的 Lighting Mode 设置为 Baked Indirect 时,混合光源的行为类似于实时光源,但有额外的好处是会将间接光照烘焙到光照贴图中。混合光源照亮的游戏对象会投射实时阴影,最大距离是在项目中定义的阴影距离 (Shadow Distance)。
将场景的 Lighting Mode 设置为 Baked Indirect 时,混合光源的行为如下:
由于混合光源中的所有阴影在 Baked Indirect 光照模式下都是实时的,因此可能会影响性能。可以使用 Shadow Distance 属性来限制 Unity 绘制实时阴影的最大距离,从而降低这种影响。
在 Baked Indirect 光照模式下,可以在运行时巧妙地更改混合光源的属性。此类更改会影响混合光源对场景的实时直接光照,但不会影响混合光源对场景的烘焙间接光照。这样便可以将间接光照的优点与实时光照的某些动态功能结合起来。由于缺少预先计算的阴影,因此在 Baked Indirect 光照模式下效果特别好。
在运行时对光源属性进行更改必须特别小心,只进行微小的更改,确保不会引起实时直接光照和烘焙间接光照之间不切实际的组合。例如,如果将红色混合光源烘焙到光照贴图中,然后在运行时将其颜色从红色更改为绿色,则直接光照将为绿色,但烘焙到光照贴图中的间接光照仍为红色。此情况同样适用于在运行时移动混合光源:直接光照将跟随光源的新位置,但间接光照将保持在光源烘焙位置。
以下视频举例说明了如何略微修改混合光源而不会导致间接光照出现明显不一致问题:https://youtu.be/XN6ya31gm1I
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.