【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 进行操作。

扫描二维码关注公众号,回复: 2517796 查看本文章

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)清除。 清除这意味着预计算的所有阶段都需要从头开始重新计算,因此可能会耗时。 但是在某些情况下,您可能需要减少磁盘使用量,这可能会有所帮助。

猜你喜欢

转载自blog.csdn.net/gaojinjingg/article/details/80749651