注意:这是一个预览功能,将来可能会更改。使用此功能的任何场景都可能需要在以后的发行版中进行更新。在该功能尚未正式发布之前,请勿在大规模生产环境中依赖此功能。
在场景中设置和调整光照时,GPU 光照贴图 (GPU Lightmapper) 可提供交互式工作流程。由于此光照贴图使用计算机中的 GPU 生成烘焙__光照贴图__和__光照探针__,因此可以替代 CPU 渐进光照贴图 (CPU Progressive Lightmapper) 并且速度更快。采样和噪声模式与 CPU 光照贴图产生的采样和噪声模式略有不同,因为采样算法不同。
要使用渐进 GPU 光照贴图,计算机必须具有:
如果计算机有多个 GPU,Unity 会自动选择一个用于渲染,另一个用于光照烘焙。要更改此设置,请参阅:配置用于光照贴图的 GPU。
注意:如果烘焙过程使用的 GPU 内存超过可用的 GPU 内存,该过程可回退到 CPU 光照贴图。一些具有虚拟内存支持的驱动程序将切换为 CPU 内存,这会使烘焙过程变慢。
要在 Unity Editor 中选择渐进 GPU 光照贴图 (Progressive GPU Lightmapper),请执行以下操作: 在项目中,选择 Window > Rendering > Lighting Settings。 在 Lightmapping Settings 下,找到 Lightmapper 属性,然后在下拉菜单中选择 Progressive GPU (Preview)。
如果计算机有多个 GPU,Unity 会自动使用一个 GPU 渲染场景,并使用另一个 GPU 烘焙光照贴图。如果 GPU 分配不符合您的需要,您可以指定用于烘焙的显卡。
要查看 Unity 当前用于烘焙的 GPU,请执行以下操作:
要查看计算机中可用的 GPU,请执行以下操作:
要选择用于烘焙的特定 GPU,请执行以下操作:
platform
和 device index
):Unity.exe "-OpenCL-PlatformAndDeviceIndices" <platform> <device index>
在处理场景时,您选择的分配应取决于您的需求。如果将最强 GPU 分配给任一活动,则可能会导致其他活动的成本增加。如果遇到问题,请尝试重新分配 GPU。
渐进 GPU 光照贴图 (Progressive GPU Lightmapper) 不支持:
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.