Introduction to 3D Lighting
Lighting is crucial for creating atmosphere and visual depth in 3D scenes. Godot provides three main light types and advanced global illumination techniques to achieve realistic and performant lighting.All light nodes inherit from the base
Light3D class (doc/classes/Light3D.xml:2).Light Types
DirectionalLight3D
Simulates distant light sources like the sun
OmniLight3D
Point light radiating in all directions
SpotLight3D
Cone-shaped light like a flashlight
DirectionalLight3D
Models infinite parallel rays from a distant source, typically used for sunlight or moonlight.Basic Setup
Light is emitted in the -Z direction of the node’s global basis. For an unrotated light, this means light travels forward.
Shadow Configuration
Shadow Split Configuration
For better shadow quality, directional lights use cascaded shadow maps:- 2 Splits
- 4 Splits
- Orthogonal
Sky Mode
Sky Mode Options
Sky Mode Options
SKY_MODE_LIGHT_AND_SKY: Affects both scene and sky (default)SKY_MODE_LIGHT_ONLY: Only lights the sceneSKY_MODE_SKY_ONLY: Only affects sky shader
OmniLight3D
Emits light in all directions from a point, like a light bulb or candle.Basic Setup
Attenuation
Controls how light fades with distance:Shadow Modes
SpotLight3D
Cone-shaped light emission, useful for flashlights, car headlights, or stage lights.Basic Setup
Light is emitted in the -Z direction. The
spot_angle is the angular radius (from center to edge), so a 45° angle creates a 90° cone.Angle and Range
Attenuation Curves
Common Light Parameters
All light types share these properties from theLight3D base class:
Energy and Color
Physical Light Units
For realistic lighting, enable physical units in Project Settings:Color Temperature
Negative Lights
Create areas of darkness:Indirect Lighting
Control contribution to global illumination:Shadows
Enabling Shadows
Shadow Quality Parameters
Percentage-Closer Soft Shadows (PCSS)
Create realistic soft shadows:PCSS is only supported in Forward+ rendering (not Mobile or Compatibility).
Shadow Cull Mask
Distance Fade (LOD)
Optimize performance by fading distant lights:Light Projectors (Cookies/Gobos)
Project textures through lights:Light projectors are only supported in Forward+ and Mobile rendering methods.
Global Illumination (GI)
Godot offers multiple GI techniques:Bake Modes
LightmapGI
Bake static lighting for best performance:1
Add LightmapGI Node
Add a
LightmapGI node to your scene.2
Configure Lights
Set lights to
BAKE_STATIC mode:3
Bake Lightmaps
Select the LightmapGI node and click “Bake Lightmaps” in the toolbar.
4
Use Baked Result
Lightmaps are automatically applied to static meshes.
VoxelGI
Real-time voxel-based global illumination:SDFGI (Signed Distance Field GI)
Enable in WorldEnvironment for large open worlds:Lighting Best Practices
Use Directional Light for Sun
Use Directional Light for Sun
Always use
DirectionalLight3D for primary outdoor lighting:Limit Active Lights
Limit Active Lights
Too many lights hurt performance. Use distance fade:
Bake Static Lighting
Bake Static Lighting
For static scenes, use LightmapGI:
Optimize Shadow Distance
Optimize Shadow Distance
Don’t render shadows too far away:
Use Cull Masks Wisely
Use Cull Masks Wisely
Exclude unnecessary objects from lighting:
Common Lighting Scenarios
Outdoor Daytime
Indoor Room with Window
Night Scene with Moonlight
Torch/Flashlight
Debugging Lights
Performance Monitoring
Related Topics
3D Overview
3D fundamentals and transforms
Meshes and Materials
How materials interact with lighting
Environment
Sky, fog, and ambient lighting
Shaders
Custom lighting in shaders
Resources
- 3D Lights and Shadows Tutorial
- Faking Global Illumination
- Light3D Reference: doc/classes/Light3D.xml
- DirectionalLight3D Reference: doc/classes/DirectionalLight3D.xml
- OmniLight3D Reference: doc/classes/OmniLight3D.xml
- SpotLight3D Reference: doc/classes/SpotLight3D.xml