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
Probes
Baked GI
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 > 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.
If you have checked Auto Generate in the bottom of Unity’s Lighting panel (menu: Window > 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.
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.
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.
See documentation on Lighting Modes for more details.
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.
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 - Leave page feedback
Light Modes added in 5.6