Version: 2019.1
Enlighten
LOD y GI en tiempo real

Using precomputed lighting

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

Cuando el proceso de precompute esté ejecutando, una barra de progreso azul aparecerá en la esquina derecha del Editor. Hay diferentes fases que necesitan completarse dependiendo si Baked GI o Precomputed Realtime GI está habilitado. La información acerca del proceso actual se muestra encima de la barra de progreso.

La barra de progreso muestra el estado actual del precompute (precalculo) de Unity.

En el ejemplo de arriba, podemos ver que estamos en la tarea 5 de 11 la cual es, ‘Clustering’ y hay 6 trabajos que faltan antes de que esa tarea haya completado y el precompute (pre-calculo) se mueve a la tarea 6. Las varias fases se listan abajo:

Precomputed Realtime GI

  1. Crea Geometría
  2. Layout Systems
  3. Create Systems
  4. Create Atlas
  5. Clustering
  6. Visibility
  7. Light Transport
  8. Tetrahedralize Probes
  9. Create ProbeSet

Probes

  1. Ambient Probes
  2. Baked/Realtime Ref. Probes

Baked GI

  1. Crea Geometría
  2. Atlassing
  3. Crea Systemas Baked
  4. Recursos Baked
  5. Bake AO
  6. Exporta Textura Baked
  7. Bake Visibilidad
  8. Bake Direct
  9. Ambient y Emissive
  10. Crea Sistemas Bake
  11. Bake Runtime
  12. Upsampling la Visibilidad
  13. Bake Indirect
  14. Final Gather
  15. Bake ProbesSet
  16. Compositing

Empezando un precompute (precalculo)

Solamente la geometría estática se considera por las soluciones de precomputed lighting de Unity. Para empezar el proceso de lighting precompute necesitamos al menos un GameObject marcado como ‘static’ en nuestra escena. Este puede ser hecho de manera individual, o seleccionando y haciendo shift en varios GameObjects del panel de Jerarquía.

Del panel del Inspector, la casilla de verificación Static se puede seleccionar (Inspector > Static). Esto configurará todas las ‘opciones static’, o ‘flags’, de los GameObjects, incluyendo la navegación y batching, en ser estáticos, lo cual puede que no se desee. Para Precomputed Realtime GI, solamente ‘Lightmap Static’ se necesita marcar.

Para un control más fino, las opciones estáticas individuales se pueden configurar de la lista desplegable accesible a la derecha de la casilla de verificación Static en el panel del Inspector. Adicionalmente, los objetos también se pueden configurar a Static en el área Object de la ventana de lighting.

If you set your Scene to Auto Generate (menu: Window > Rendering > Lighting Settings > Scene > Auto Generate), Unity’s lighting precompute begins automatically, and updates automatically when any static geometry in your Scene changes. If you do not enable Auto Generate, you must start the lighting precompute manually.

Auto/manual precompute

If you have checked Auto Generate in the bottom of Unity’s Lighting panel (menu: Window > Rendering > Lighting Settings > Scene > Auto Generate), this precompute begins automatically as a background process whenever the static geometry within your Scene changes.

However, if you have not enabled Auto Generate, you must manually start the lighting precompute process by clicking the ‘Build’ button next to it. This begins the precompute in much the same way, and gives you control over when this process starts.

Auto Generate can be useful when working on smaller or less complex Scenes, because it quickly produces accurate lighting results while you move or editing static GameObjects in your Scene. However, when working on large or complex Scenes, you might prefer to switch to the manual option, so that your computer is not running a high CPU usage and repeatedly re-starting the lighting precompute each time you modify your Scene.

When you manually initiate a precompute, all aspects of your Scene lighting are evaluated and computed. To recalculate and bake just the Reflection Probes by themselves, click the drop-down menu attached to the Generate Lighting button (menu: Window > Lighting Settings > Scene > Generate Lighting) and select Bake Reflection Probes.

NOTE: When using Auto Generate mode, Unity stores your lighting data in a temporary cache with a limited size. This means that when you exceed the cache’s size, Unity deletes old lighting data. A problem might occur when building your project if some of your Scenes rely on auto-generated lighting data that has been deleted. In this case, your Scenes might not have the correct lighting in the built project. Therefore, before building your game, you should uncheck Auto Generate, and generate the lighting data manually for all your Scenes. Unity then saves your lighting data as Asset files in your project folder, which means you have the data saved as part of your project and included in your build.

Enabling Baked GI or Realtime GI

Unity enables both Baked GI and Realtime GI by default. Baked GI is all precomputed; Realtime GI carries out some precomputation when indirect lighting is used. With both enabled, you then use each individual Light in your Scene to control which GI system it should use (in the Light component, use the Mode setting to do this). See documentation on the Lighting window and Global Illumination to learn more.

The most flexible way to use the lighting system is to use Baked GI and Realtime GI together. However, this is also the most performance-heavy option. To make your game less resource-intensive, you can choose to disable Realtime GI or Baked GI. Note that doing this this reduces the flexibility and functionality of your lighting system.

To manually enable or disable Global Illumination, open the Lighting window (Window > Lighting Settings > Scene). Tick Realtime Global Illumination to enable Realtime GI, and tick Baked Global Illumination to enable Baked GI. Untick these checkboxes to disable the respective GI system. If any Lights are set to the mode you have disabled, they are are overridden and set to the active GI system.

Configuraciones por luz

To set properties for each individual Light, select it in the Scene or Hierarchy window, then edit the settings on the Light component in the Inspector window.

The default Mode for each light is Dynamic. This means that the Light contributes direct lighting to your Scene, and Unity’s Realtime GI handles indirect lighting.

If you set the Light’s Mode to Static, then that Light only contributes lighting to Unity’s Baked GI system. Both direct and indirect lighting from those Lights are baked into light maps, and cannot be changed during gameplay.

If you set the Light’s Mode to Stationary, GameObjects marked as Static still include this light in their Baked GI light maps. However, unlike Lights marked as Static, Stationary Lights still contribute real-time lighting, based on the stationary bake mode in the Lighting window (menu: Window > Lighting Settings). This is useful if you are using light maps in a static environment, but you still want a good integration between dynamic and light map static geometry.

A Directional Light with the Mode set to Dynamic.
A Directional Light with the Mode set to Dynamic.

See documentation on Lighting Modes for more details.

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.

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.

LOD para baked GI

Level-of-detail (nivel de detalle) se toma en consideración cuando Unity genera baked lightmaps. La iluminación directa se calcula utilizando las superficies actuales de todos los LODs. Niveles LOD más bajos utilizan light probes para recoger iluminación indirecta. La iluminación resultante se baked a un lightmap.

Esto significa que debería colocar light probes alrededor de sus LODs para capturar una iluminación indirecta. El objeto no utilizará lightprobes en tiempo de ejecución si utiliza un baked GI completo.


  • 2017–06–08 Page published with limited editorial review

  • Light Modes added in 5.6

Enlighten
LOD y GI en tiempo real
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961