【Unity-Graphics】The Precompute Process

預計算過程 The Precompute Process

In Unity, precomputed lighting is calculated in the background - either as an automatic process, or it is initiated manually. In either case, it is possible to continue working in the editor while these processes run behind-the-scenes.

在Unity中,預計算的光照是在後臺計算的,無論是作爲自動進程,還是手動啓動的。 在任何一種情況下,可以在編輯器中繼續工作,而這些進程會在幕後運行。

When the precompute process is running, a blue progress bar will appear in the bottom right of the Editor. There are different stages which need to be completed depending on whether Baked GI or Precomputed Realtime GI is enabled. Information on the current process is shown on-top of the progress bar.

當預計算進程運行時,編輯器右下角將出現一個藍色進度條。 它有不同的階段需要完成,這取決於是否啓用烘焙GI或預計算實時GI。 有關當前進程的信息顯示在進度條的頂部。

這裏寫圖片描述

Progress bar showing the current state of Unity’s precompute.

顯示Unity預先計算的當前狀態的進度條。

In the example above, we can see that we are at task 5 of 11 which is, ‘Clustering’ and there are 108 jobs remaining before that task is complete and the precompute moves on to task 6. The various stages are listed below:

在上面的圖中,我們可以看到當前的任務是“聚類”(總共11個任務中的第5個),在該任務完成之前還有108個工作要完成,之後預計算將開始任務6。各個階段的任務如下:

Precomputed Realtime GI(預計算實時GI) Baked GI(烘焙GI)
01 - Create Geometry 01 - Create Geometry
02 - Layout Systems 02 - Atlassing
03 - Create Systems 03 - Create Baked Systems
04 - Create Atlas 04 - Baked Resources
05 - Clustering 05 - Bake AO
06 - Visibility 06 - Export Baked Texture
07 - Light Transport 07 - Bake Visibility
08 - Tetrahedralize Probes 08 - Bake Direct
09 - Create ProbeSet 09 - Ambient and Emissive
10 - Create Bake Systems
Probes 11 - Bake Runtime
12 - Upsampling Visibility
01 - Ambient Probes 13 - Bake Indirect
02 - Baked/Realtime Ref. Probes 14 - Final Gather
15 - Bake ProbesSet
16 - Compositing

啓動預計算 Starting a Precompute

Only static geometry is considered by Unity’s precomputed lighting solutions. To begin the lighting precompute process we need at least one GameObject marked as ‘static’ in our scene. This can either be done individually, or by shift-selecting multiple GameObjects from the hierarchy panel.

Unity預計算的光照解決方案僅考慮靜態幾何體。 爲了開始光照的預計算過程,我們需要在我們的場景中放置至少一個標記爲“Static”的 GameObject 。 在 hierarchy 面板中選擇一個或選擇多個 GameObjects 進行操作。

From the Inspector panel, the Static checkbox can be selected (Inspector>Static). This will set all of the GameObject’s ‘static options’, or ‘flags’, including navigation and batching, to be static, which may not be desirable. For Precomputed Realtime GI, only ‘Lightmap Static’ needs to be checked.

從“Inspector”面板中,可以勾選“Static”複選框(“Inspector>“Static”)。這將會將所有GameObject 的“Static options”或“flags”(包括導航和批處理)設置爲靜態的,這可能是不可取的。 對於預計算實時GI,只需要勾選“Lightmap Static”。

這裏寫圖片描述

For more fine-grained control, individual static options can be set from the drop-down list accessible to the right of the Static checkbox in the Inspector panel. Additionally, objects can also be set to Static in the Object area of the lighting window.

對於更加精細的控制,可以從 Inspector 面板的“Static”複選框右側的下拉列表中設置各個靜態選項。 此外,對象也可以在 Lighting 窗口的“Object”區域中設置爲“Static”。

這裏寫圖片描述

If your scene is set to Auto (Lighting>Scene>Auto), Unity’s lighting precompute will now begin automatically. Otherwise it will need to be started manually as described below.

如果您的場景設置爲 Auto(Lighting > Scene > Auto),Unity的光照預計算將自動開始。 否則將需要手動啓動,如下所述:

自動/手動預計算 Auto/Manual Precompute

If ‘Auto’ is checked from the bottom of Unity’s Lighting panel (Lighting>Scene>Auto), then this precompute will begin automatically as a background process whenever changes are made to static geometry within your scene.

如果從Unity的“Lighting”面板(Lighting > Scene > Auto)底部選中“Auto”,則在對場景中的靜態幾何體進行更改時,此預計算將自動作爲後臺進程開始。

However, if Auto is not selected, you will need to manually start a precompute by clicking the ‘Build’ button next to it. This will begin the precompute in much the same way, while giving you control over when this process starts.

但是,如果未選擇“Auto”,則需要通過單擊旁邊的“Generate”按鈕手動啓動預計算。 這將以相同的方式開始預計算,同時讓您控制此過程何時開始。

這裏寫圖片描述

Manually initiating a precompute will cause all aspects of your scene lighting to be evaluated and (re)computed. If you wish to selectively recalculate Reflection probes by themselves, this can be done via the drop-down menu next to the Build button (Lighting>Scene>Build).

手動啓動預先計算將導致對場景照明的所有方面進行評估和(重新)計算。 如果您希望自己選擇性地重新計算反射探針,可以通過“Generate”按鈕(Lighting>Scene>Build)旁邊的下拉菜單來完成。

GI緩存 GI Cache

In either Baked GI or Precomputed Realtime GI, Unity ‘caches’ (stores) data about your scene lighting in the ‘GI Cache’, and will try to reuse this data whenever possible to save time during precompute. The number and nature of the changes you have made to your scene will determine how much of this data can be reused, if at all.

不論是在烘焙GI或預計算實時GI中,Unity可以緩存(存儲)有關場景照明的數據爲“GI緩存”,並儘可能地重用此數據,以便在預計算中節省時間。 您對場景進行的更改的數量和性質將決定如何重複使用這些數據。

This cache is stored outside of your Unity project and can be cleared using (Preference>GI Cache>Clear Cache). Clearing this means that all stages of the precompute will need to be recalculated from the beginning and this can therefore be time consuming. However in some cases, where perhaps you need to reduce disk usage, this may be helpful.

此緩存存儲在Unity項目之外,可以使用(Preference>GI Cache>Clear Cache)清除。 清除這意味着預計算的所有階段都需要從頭開始重新計算,因此可能會耗時。 但是在某些情況下,您可能需要減少磁盤使用量,這可能會有所幫助。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章