Version: 2023.2
渐进光照贴图程序
光照贴图:入门

The Progressive GPU Lightmapper

The Progressive GPU Lightmapper is a backend for the Progressive Lightmapper which uses your computer’s GPU and Dedicated Video Ram (VRAM) to generate baked lightmaps and Light Probes.

硬件和软件要求

为了使用渐进 GPU 光照贴图,您的计算机必须满足以下最低规格:

  • 至少一个支持 OpenCL 1.2 的 GPU
  • At least 2GB of VRAM dedicated to that GPU
  • 一个支持 SSE4.1 指令的 CPU

如果您正在烘焙的场景所需的 VRAM 多于指定 GPU 上可用 VRAM,则烘焙时间会显著增加。有关可帮助您减少烘焙场景所需时间的信息,请参阅性能。

The Progressive GPU Lightmapper does not support OpenCL CPU devices.

性能

In most configurations, the Progressive GPU Lightmapper performs much faster than the Progressive CPU Lightmapper. The performance depends on the selected Baking Profile.

However, the specifications of the GPU you use to bake and the amount of VRAM dedicated to that GPU both influence your experience of the lightmapper’s performance.

Other applications competing for GPU resources also have an impact on baking performance. Depending on your hardware vendor, reductions in the amount of VRAM available to Unity can slow down the bake process or cause it to fail. When Auto Generate is enabled, the Progressive GPU Lightmapper might fall back to the CPU Lightmapper if Unity can’t allocate enough GPU memory. Closing other applications while you are working with this functionality can improve stability and performance.

In order to achieve results of the same quality as the Progressive CPU Lightmapper, the Progressive GPU Lightmapper needs up to four times more indirect light samples. The Progressive CPU Lightmapper uses an approach called branched path tracing, which launches more light rays at each bounce. The branched path tracing approach is not suitable for GPUs.

Unity provides a spreadsheet to help you determine how much memory the Progressive GPU Lightmapper needs to bake your scene. For more information see the Progressive GPU Lightmapper Memory Spreadsheet .

Preventing baking speed slowdowns caused by lightmapper tiling

The Progressive GPU Lightmapper includes a feature called lightmapper tiling. Lightmapper tiling prevents the Progressive GPU Lightmapper from using all available GPU memory. Instead, Unity allocates some temporary memory on the CPU, then bakes your lighting in tiles that are sized to match the amount of GPU memory available. When Auto Generate is enabled, the tiling feature is active only when Unity can’t allocate enough GPU memory to bake the entire lightmap. When baking is started using the Generate Lighting button or the API, Unity configures the tiling based on the selected Baking Profile. The Progressive CPU Lightmapper does not include a tiling feature.

When Auto Generate is enabled, and Unity activates lightmapper tiling, Unity stops showing progressive updates of the baked lighting in the Scene view. However, the Progressive updates setting in the Lighting window does not visibly deactivate. When the tiling feature is active, and when the lightmap atlas resolution is 512px or bigger, the baking process is likely to be slower than baking the same scene without tiling.

It is not possible to disable tiling when Auto Generate is enabled. However, you can reduce the likelihood of its activation by using the following strategies:

  • Increase the amount of GPU memory available for Unity to use by closing other applications.

  • Reduce the level of anti-aliasing in your project. Navigate to Project Settings > Quality and choose an option that takes fewer samples. For example, you might switch from 8x Multi Sampling to 2x Multi Sampling.

  • Reduce your lightmap resolution.

  • Disable ambient occlusion. Open the Lighting window (menu: Window > Rendering > Lighting). In the Lightmapping Settings interface, disable Ambient Occlusion.

  • Bake only indirect light. Set all your light sources to Realtime or Mixed. Make sure that no light sources are set to Baked. If you use the mixed approach, set Lighting > Mixed Lighting > Lighting mode to Baked Indirect.

  • Reduce the quality of your lightmaps in your Lightmap Parameters Asset. Open the Lighting window, expand Lightmapping settings, and select a lower-resolution option for Lightmap parameters.

  • Use a CPU-based denoiser. To choose a denoiser, open the Lighting window, expand Lightmapping settings, set Filtering to Advanced and then select the denoiser for each type of lightmap target (Direct and Indirect). Only Open Image is CPU-based. RadeonPro and Optix are GPU-based, but RadeonPro uses a lot more GPU memory.

If you still can’t successfully bake in Auto Generate mode, use On Demand mode and choose a Baking Profile suitable for your scene.

Platform-specific limitations

On macOS it is more difficult to determine how much memory is available. As a result, fallback to CPU is more likely on this platform and it is a best practice to follow instructions for optimizing your bake speed.

如何优化烘焙速度

有多种方法可以减少烘焙时间并避免烘焙超过指定给 GPU 用于烘焙的 VRAM 的情况。

  • Close other GPU-accelerated applications. GPU-accelerated 2D image editing and 3D modelling software uses VRAM. Turn off accelerated graphics functionality or quit these applications.

  • Use Light Probes for smaller GameObjects. GameObjects such as debris or small props use up space in lightmaps but might not contribute significantly to the look of a scene. To optimize bake speed, disable Contribute Global Illumination for these GameObjects’ Mesh Renderers and light them with Light Probes instead.

  • Designate separate GPUs for rendering and baking. If your computer has more than one GPU, you can designate one for rendering and one for baking. See Configure GPU selection below.

  • Use a lower number of Anti-aliasing samples. The default value for this setting in the Lightmap Parameters Asset is 8. When you increase it, Unity uses more VRAM. When you are using a lightmap size of 4096 or above, this can quickly exceed the memory of many consumer GPUs.

  • Use fewer samples (Direct Samples, Indirect Samples, Environment Samples) and use the Denoiser to clean up the remaining noise in the lightmap.

Configure GPU selection

If you have at least two GPUs, you can specify one GPU for rendering the Scene and another for baking lighting. This might be desirable in cases where there is insufficient VRAM available for the default GPU to both render your scene and bake it using the Progressive GPU Lightmapper.
To change which GPU Unity uses for baking:
1. Open the Lighting window (menu: Window > Rendering > Lighting).
2. Navigate to the Workflow Settings section.
3. Use the GPU Baking Device drop-down menu to select a GPU.

渐进光照贴图程序
光照贴图:入门
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961