本页将介绍 Unity 中光照的工作方式。
Unity 中光照的工作方式类似于光在现实世界中的情况。Unity 使用详细的光线工作模型来获得更逼真的结果,并使用简化模型来获得更具风格化的结果。
直射光是发出后照射到表面一次再被直接反射到传感器(例如眼睛的视网膜或摄像机)中的光。间接光是最终反射到传感器中的所有其他光线,包括多次照射到表面的光线和天光。为了获得逼真的光照效果,需要模拟直射光和间接光。
Unity 可以计算直接光照和/或间接光照。Unity 使用什么光照技术取决于项目的配置方式。
实时光照是指 Unity 在运行时计算光照。烘焙光照是指 Unity 提前执行光照计算并将结果保存为光照数据,然后在运行时应用。在 Unity 中,项目可以使用实时光照、烘焙光照或两者的混合(称为混合光照)。
有关配置 Light 组件以提供实时、烘焙或混合光照的信息,请参阅光源模式。
全局光照是对直接和间接光照进行建模以提供逼真光照效果的一组技术。Unity 有两个全局光照系统,结合了直接光照和间接光照。
烘焙全局光照系统包括光照贴图、光照探针和反射探针。所有渲染管线均支持烘焙全局光照 (Baked Global Illumination) 系统。每个功能的文档中指出了烘焙全局光照系统中该功能的渲染管线支持情况。
The Realtime Global Illumination system comprises Realtime Global Illumination using Enlighten, and adds additional functionality to Light Probes. The Built-in Render Pipeline supports Realtime Global Illumination. The High Definition Render Pipeline (HDRP) and the Universal Render Pipeline (URP) do not support the Realtime Global Illumination system.
See the HDRP and URP documentation for compatibility information specific to scriptable render pipelines. Unless otherwise specified, the Built-In Render Pipeline supports all features described in this article.
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.