Version: 2023.2
言語: 日本語
プログレッシブライトマッパー
ライトマッピング - はじめに

The Progressive GPU Lightmapper

プログレッシブ GPU ライトマッパーは、プログレッシブライトマッパー のバックエンドで、コンピューターの GPU と Dedicated Video Ram (VRAM) を使用して、ベイクした ライトマップライトプローブ を生成します。

ハードウェアとソフトウェアの要件

プログレッシブ GPU ライトマッパーを使用するには、コンピューターが以下の最低要件を満たす必要があります。

  • OpenCL 1.2 をサポートする少なくとも 1 つの GPU
  • At least 2GB of VRAM dedicated to that GPU
  • SSE4.1 命令をサポートする CPU

ベイクするシーンが、指定された 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.

ただし、ベイクに使用する GPU の仕様と、その GPU 専用の VRAM 容量の両方が、ライトマッパーのパフォーマンスに影響します。

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.

プログレッシブ CPU ライトマッパーと同じ品質の結果を得るために、プログレッシブ GPU ライトマッパーは最大で 4 倍の間接光サンプルを必要とします。プログレッシブ CPU ライトマッパーは、各バウンスでより多くの光線を放射する、分岐パストレーシング (branched path tracing) と呼ばれる方法を用いています。分岐パストレーシングを用いる方法は GPU には適していません。

Unity は、プログレッシブ GPU ライトマッパーがシーンのベイクに必要とするメモリ量を特定するために役立つスプレッドシートを提供しています。詳細は プログレッシブ GPU ライトマッパーメモリスプレッドシート を参照してください。

ライトマッパータイリングによるベイク速度低下の防止

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.

  • ライトマップの解像度を低くします。

  • アンビエントオクルージョン を無効にします。Lighting ウィンドウ (メニュー: Window > Rendering > Lighting) を開き、Lightmapping Settings インターフェース内で Ambient Occlusion を無効にしてください。

  • 間接光のみをベイクします。全ての光源を Realtime または Mixed に設定します。Baked に設定された光源がないことを確認してください。混合 (Mixed) アプローチを使用する場合は、Lighting > Mixed Lighting > Lighting modeBaked 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.

プラットフォーム固有の制限

macOS では、使用可能なメモリ量の特定がより困難です。そのため、このプラットフォームでは CPU にフォールバックする可能性が高く、したがってベイク速度を最適化するための指示に従うことが推奨されます。

ベイク速度を最適化する方法

ベイク時間を短縮し、ベイク処理の使用メモリが、GPU がベイク用に使用できる指定の VRAM 容量を超えないようにする方法は、いくつかあります。

  • 他の GPU アクセラレーションアプリケーションを終了します。GPU アクセラレーションによる 2D 画像編集ソフトや 3D モデリングソフトは VRAM を使用します。グラフィックスアクセラレーション機能をオフにするか、これらのアプリケーションを終了してください。

  • 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.

  • レンダリング用とベイク用に別々の GPU を指定します。 コンピューターに複数の GPU が搭載されている場合は、1 つをレンダリング用に、1 つをベイク用に指定することができます。以下の、GPU の選択に関するセクションを参照してください。

  • 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.

GPU 選択の設定

2 つ以上の GPU がある場合は、1 つの GPU をシーンのレンダリング用に指定し、もう 1 つを GPU をライティングのベイク用に指定することができます。デフォルト GPU の使用できる VRAM 容量が、シーンのレンダリングとプログレッシブ GPU ライトマッパーによるべイクの両方を行うのに十分でない場合には、この方法が適している場合があります。
以下の手順で、Unity が ベイクに使用する GPU を変更できます。 1. Open the Lighting window (menu: Window > Rendering > Lighting).
2. Workflow Settings セクションに移動します。
3. GPU Baking Device ドロップダウンメニューを使用して GPU を選択します。

プログレッシブライトマッパー
ライトマッピング - はじめに