Enhanced lighting techniques.
See also: [[Godot - Environments]], [[Godot - Shaders List]]
# Techniques
## LightmapGI
The `LightmapGI`[^1] node provides light probes and baked lighting as well as dynamic lights.
### LightmapGI Baking Domain
> The LightmapGI node only bakes light data for child nodes of its parent. Nodes further up the hierarchy of the scene will not be baked.
\- Official LightmapGI documentation[^1]
### LightmapGI Baking Mesh Limitations
> Lightmap baking on CSGShape3Ds and PrimitiveMeshes is not supported, as these cannot store UV2 data required for baking.
\- Official LightmapGI documentation[^1]
### Runtime LightmapGI Baking
> Lightmap baking functionality is only available in the editor. This means LightmapGI is not suited to procedurally generated or user-built levels. For procedurally generated or user-built levels, use VoxelGI or SDFGI instead (see `Environment.sdfgi_enabled`).
\- Official LightmapGI documentation[^1]
## SDFGI
> enables signed distance field global illumination for meshes that have their GeometryInstance3D.gi_mode set to GeometryInstance3D.GI_MODE_STATIC. SDFGI is a real-time global illumination technique that works well with procedurally generated and user-built levels, including in situations where geometry is created during gameplay.
\- Official SDFGI documentation[^2]
### SDFGI Limitations
> Dynamic lights are supported, but dynamic occluders and emissive surfaces are not.
\- Official SDFGI documentation[^2]
### SDFGI Performance Impact
> SDFGI is relatively demanding on the GPU and is not suited to low-end hardware such as integrated graphics (consider LightmapGI instead). To improve SDFGI performance, enable ProjectSettings.rendering/global_illumination/gi/use_half_resolution in the Project Settings.
\- Official SDFGI documentation[^2]
### SDFGI Thin Walls and Enclosed Spaces
> Meshes should have sufficiently thick walls to avoid light leaks (avoid one-sided walls). For interior levels, enclose your level geometry in a sufficiently large box and bridge the loops to close the mesh.
\- Official SDFGI documentation[^2]
## VoxelGI
> VoxelGIs are used to provide high-quality real-time indirect light and reflections to scenes.
\- Official VoxelGI documentation[^3]
```cardlink
url: https://youtu.be/plZQN52S44w
title: "Make your Godot game look AAA"
description: "If you want your Godot game to look more like a high-end title and less like a student project, voxel lighting is a great place to start. In this tutorial, I..."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/daa21ba0/img/logos/favicon_32x32.png
image: https://i.ytimg.com/vi/plZQN52S44w/maxresdefault.jpg
```
### Runtime VoxelGI Baking
> VoxelGI can be baked in an exported project, which makes it suitable for procedurally generated or user-built levels as long as all the geometry is generated in advance. For games where geometry is generated at any time during gameplay, SDFGI is more suitable (see Environment.sdfgi_enabled).
\- Official VoxelGI documentation[^3]
### VoxelGI Performance Impact
> VoxelGI is relatively demanding on the GPU and is not suited to low-end hardware such as integrated graphics (consider LightmapGI instead). To improve performance, adjust `ProjectSettings.rendering/global_illumination/voxel_gi/quality` and enable `ProjectSettings.rendering/global_illumination/gi/use_half_resolution` in the Project Settings.
>
> To provide a fallback for low-end hardware, consider adding an option to disable VoxelGI in your project's options menus. A VoxelGI node can be disabled by hiding it.
\- Official VoxelGI documentation[^3]
### VoxelGI Thin Walls and Enclosed Spaces
> Meshes should have sufficiently thick walls to avoid light leaks (avoid one-sided walls). For interior levels, enclose your level geometry in a sufficiently large box and bridge the loops to close the mesh.
>
> To further prevent light leaks, you can also strategically place temporary MeshInstance3D nodes with their `GeometryInstance3D.gi_mode` set to `GeometryInstance3D.GI_MODE_STATIC`. These temporary nodes can then be hidden after baking the VoxelGI node.
\- Official VoxelGI documentation[^3]
# References
```cardlink
url: https://youtu.be/SKeHHrIoPLY
title: "Trenchbroom is AWESOME - Testing in Godot 4 (Level Building example)"
description: "Trenchbroom is a map editor which has been made compatible with Godot by using the Qodot plugin.It works really well, and I am still learning the ropes of ho..."
host: youtu.be
favicon: https://www.youtube.com/s/desktop/aba54451/img/logos/favicon_32x32.png
image: https://i.ytimg.com/vi/SKeHHrIoPLY/maxresdefault.jpg?sqp=-oaymwEnCIAKENAF8quKqQMb8AEB-AH-CYAC0AWKAg0IABABGIwBIFQoFTAP&rs=AOn4CLAvsQBlJOrbThzuaFeouBZJeS1KSw
```
[^1]: https://docs.godotengine.org/en/stable/classes/class_lightmapgi.html
[^2]: https://docs.godotengine.org/en/stable/classes/class_environment.html#class-environment-property-sdfgi-enabled
[^3]: https://docs.godotengine.org/en/stable/classes/class_voxelgi.html#class-voxelgi