Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Signed distance field global illumination (SDFGI)
Signed distance field global illumination (SDFGI) is a novel technique available in Godot. It provides semi-real-time global illumination that scales to any world size and works with procedurally generated levels.
SDFGI supports dynamic lights, but not dynamic occluders or dynamic emissive surfaces. Therefore, SDFGI provides better real-time ability than baked lightmaps, but worse real-time ability than VoxelGI.
From a performance standpoint, SDFGI is one of the most demanding global illumination techniques in Godot. Like with VoxelGI, there are still many settings available to tweak its performance requirements at the cost of quality.
Importante
SDFGI is only supported when using the Forward+ renderer, not the Mobile or Compatibility renderers.
Vedi anche
Not sure if SDFGI is suited to your needs? See Quale tecnica di illuminazione globale dovrei utilizzare? for a comparison of GI techniques available in Godot 4.
Confronto visivo
SDFGI disabilitato.
SDFGI enabled.
Configurare SDFGI
In Godot, SDFGI is the global illumination technique with the fewest required steps to enable:
Make sure your MeshInstance nodes have their Global Illumination > Mode property set to Static in the inspector.
For imported 3D scenes, the bake mode can be configured in the Import dock after selecting the 3D scene file in the FileSystem dock.
Aggiungi un nodo WorldEnvironment e crea una risorsa Environment per esso.
Modifica la risorsa Environment , scorri in basso fino alla sezione SDFGI ed espandila.
Abilita SDFGI > Enabled. SDFGI seguirà automaticamente la telecamera quando si muove, quindi non è necessario configurare extents (a differenza di VoxelGI).
Proprietà SDFGI di ambiente
Nella risorsa Environment sono disponibili diverse proprietà per regolare l'aspetto e la qualità dell'SDFGI:
Use Occlusion: se abilitata, SDFGI proietterà raggi in più per individuare e ridurre le perdite di luce. Ciò ha un impatto sulle prestazioni, quindi abilita questa proprietà solo se effettivamente necessaria.
Read Sky Light: se abilitata, l'illuminazione ambientale viene rappresentata nell'illuminazione globale. Questa opzione dovrebbe essere abilitata nelle scene all'aperto e disabilitata nelle scene completamente al coperto.
Bounce Feedback: By default, indirect lighting only bounces once when using SDFGI. Setting this value above
0.0will cause SDFGI to bounce more than once, which provides more realistic indirect lighting at a small performance cost. Sensible values are usually between0.3and1.0depending on the scene. Note that in some scenes, values above0.5can cause infinite feedback loops to happen, causing the scene to become extremely bright in a few seconds' time. If your indirect lighting looks "splotchy", consider increasing this value above0.0to get more uniform-looking lighting. If your lighting ends up looking too bright as a result, decrease Energy to compensate.Cascades: valori più alti risultano in informazioni di GI più dettagliate (e/o una maggiore distanza massima), ma hanno un impatto significativo sulle prestazioni della CPU e GPU. L'impatto di avere più cascate aumenta soprattutto quando la telecamera si muove velocemente, quindi si consiglia di ridurre questo valore a
4o meno se la telecamera si muove velocemente.Min Cell Size: la dimensione minima della celle SDFGI da utilizzare per la cascata più vicina e dettagliata. Valori inferiori risultano in un'illuminazione indiretta e una riflessione più accurate a scapito di prestazioni inferiori. Regolare questa impostazione influisce automaticamente anche su Cascade 0 Distance e Max Distance.
Cascade 0 Distance: la distanza alla quale termina la cascata più vicina e dettagliata. Valori più elevati rendono la transizione della cascata più vicina meno evidente, a scapito di ridurre il livello di dettaglio della cascata stessa. Regolare questa impostazione influisce automaticamente anche su Min Cell Size e Max Distance .
Max Distance: Controls how far away the signed distance field will be computed (for the least detailed cascade). SDFGI will not have any effect past this distance. This value should always be set below the Camera's Far value, as there is no benefit in computing SDFGI past the viewing distance. Adjusting this setting also affects Min Cell Size and Cascade 0 Distance automatically.
Y Scale: Controls how far apart SDFGI probes are spread vertically. By default, vertical spread is the same as horizontal. However, since most game scenes aren't highly vertical, setting the Y Scale to
75%or even50%can provide better quality and reduce light leaks without impacting performance.Energy: The brightness multiplier for SDFGI's indirect lighting.
Normal Bias: The normal bias to use for SDFGI's probe ray bounces. Unlike Probe Bias, this only increases the value in relation to the mesh's normals. This makes the bias adjustment more nuanced and avoids increasing the bias too much for no reason. Increase this value if you notice striping artifacts in indirect lighting or reflections.
Probe Bias: The bias to use for SDFGI's probe ray bounces. Increase this value if you notice striping artifacts in indirect lighting or reflections.
Interazione di SDFGI con luci e oggetti
The amount of indirect energy emitted by a light is governed by its color, energy and indirect energy properties. To make a specific light emit more or less indirect energy without affecting the amount of direct light emitted by the light, adjust the Indirect Energy property in the Light3D inspector.
To ensure correct visuals when using SDFGI, you must configure your meshes and lights' global illumination properties according to their purpose in the scene (static or dynamic).
Sono disponibili 3 modalità di illuminazione globale per le mesh:
Disabled: The mesh won't be taken into account in SDFGI generation. The mesh will receive indirect lighting from the scene, but it will not contribute indirect lighting to the scene.
Static (default): The mesh will be taken into account in SDFGI generation. The mesh will both receive and contribute indirect lighting to the scene. If the mesh is changed in any way after SDFGI is generated, the camera must move away from the object then move back close to it for SDFGI to regenerate. Alternatively, SDFGI can be toggled off and back on. If neither is done, indirect lighting will look incorrect.
Dynamic (not supported with SDFGI): The mesh won't be taken into account in SDFGI generation. The mesh will receive indirect lighting from the scene, but it will not contribute indirect lighting to the scene. This acts identical to the **Disabled* bake mode when using SDFGI.*
Inoltre, sono disponibili 3 modalità di preparazione per le luci (DirectionalLight3D, OmniLight3D e SpotLight3D):
Disabled: The light won't be taken into account for SDFGI baking. The light won't contribute indirect lighting to the scene.
Static: The light will be taken into account for SDFGI baking. The light will contribute indirect lighting to the scene. If the light is changed in any way after baking, indirect lighting will look incorrect until the camera moves away from the light and back (which causes SDFGI to be baked again). will look incorrect. If in doubt, use this mode for level lighting.
Dynamic (default): The light won't be taken into account for SDFGI baking, but it will still contribute indirect lighting to the scene in real-time. This option is slower compared to Static. Only use the Dynamic global illumination mode on lights that will change significantly during gameplay.
Nota
La quantità di energia indiretta emessa da una luce dipende dal suo colore, dalla sua energia e dalle sue proprietà di energia indiretta. Per fare in modo che una luce specifica emetta più o meno energia indiretta, senza influenzare la quantità di luce diretta emessa dalla luce stessa, bisogna regolare la proprietà Indirect Energy nell'ispettore del Light3D.
Vedi anche
Consultare Quale modalità di illuminazione globale si dovrebbe usare su mesh e luci? per le raccomandazioni generali sull'utilizzo.
Adjusting SDFGI performance and quality
Since SDFGI is relatively demanding, it will perform best on systems with recent dedicated GPUs. On older dedicated GPUs and integrated graphics, tweaking the settings is necessary to achieve reasonable performance.
In the Project Settings' Rendering > Global Illumination section, SDFGI quality can also be adjusted in several ways:
Sdfgi > Probe Ray Count: Higher values result in better quality, at the cost of higher GPU usage. If this value is set too low, this can cause surfaces to have visible "splotches" of indirect lighting on them due to the number of rays thrown being very low.
Sdfgi > Frames To Converge: Higher values result in better quality, but GI will take more time to fully converge. The effect of this setting is especially noticeable when first loading a scene, or when lights with a bake mode other than Disabled are moving fast. If this value is set too low, this can cause surfaces to have visible "splotches" of indirect lighting on them due to the number of rays thrown being very low. If your scene's lighting doesn't have fast-moving lights that contribute to GI, consider setting this to
30to improve quality without impacting performance.Sdfgi > Frames To Update Light: Lower values result in moving lights being reflected faster, at the cost of higher GPU usage. If your scene's lighting doesn't have fast-moving lights that contribute to GI, consider setting this to
16to improve performance.Gi > Use Half Resolution: If enabled, both SDFGI and VoxelGI will have their GI buffer rendering at halved resolution. For instance, when rendering in 3840×2160, the GI buffer will be computed at a 1920×1080 resolution. Enabling this option saves a lot of GPU time, but it can introduce visible aliasing around thin details.
SDFGI rendering performance also depends on the number of cascades and the cell size chosen in the Environment resource (see above).
Svantaggi di SDFGI
SDFGI has some downsides due to its cascaded nature. When the camera moves, cascade shifts may be visible in indirect lighting. This can be alleviated by adjusting the cascade size, but also by adding fog (which will make distant cascade shifts less noticeable).
Additionally, performance will suffer if the camera moves too fast. This can be fixed in two ways:
Ensuring the camera doesn't move too fast in any given situation.
Temporarily disabling SDFGI in the Environment resource if the camera needs to be moved at a high speed, then enabling SDFGI once the camera speed slows down.
When SDFGI is enabled, it will also take some time for global illumination to be fully converged (25 frames by default). This can create a noticeable transition effect while GI is still converging. To hide this, you can use a ColorRect node that spans the whole viewport and fade it out when switching scenes using an AnimationPlayer node.
The signed distance field is only updated when the camera moves in and out of a cascade. This means that if geometry is modified in the distance, the global illumination appearance will be correct once the camera gets closer. However, if a nearby object with a bake mode set to Static or Dynamic is moved (such as a door), the global illumination will appear incorrect until the camera moves away from the object.
SDFGI's sharp reflections are only visible on opaque materials. Transparent materials will only use rough reflections, even if the material's roughness is lower than 0.2.