Up to date

This page is up to date for Godot 4.0. If you still find outdated information, please open an issue.

3D lights and shadows

Introduction

Light sources emit light that mixes with the materials and produces a visible result. Light can come from several types of sources in a scene:

  • From the material itself, in the form of the emission color (though it does not affect nearby objects unless baked or screen-space indirect lighting is enabled).

  • Light nodes: DirectionalLight3D, OmniLight3D and SpotLight3D.

  • Ambient light in the Environment or Reflection probes.

  • Global illumination (LightmapGI, VoxelGI or SDFGI).

The emission color is a material property. You can read more about it in the Standard Material 3D and ORM Material 3D tutorial.

See also

You can compare various types of lights in action using the 3D Lights and Shadows demo project.

Light nodes

There are three types of light nodes: DirectionalLight3D, OmniLight3D and SpotLight3D. Let's take a look at the common parameters for lights:

../../_images/light_params.png

Each property has a specific function:

  • Color: Base color for emitted light.

  • Energy: Energy multiplier. This is useful for saturating lights or working with High dynamic range lighting.

  • Indirect Energy: Secondary multiplier used with indirect light (light bounces). This works with Using Lightmap global illumination, VoxelGI or SDFGI.

  • Volumetric Fog Energy: Secondary multiplier used with volumetric fog. This only has an effect when volumetric fog is enabled.

  • Negative: Light becomes subtractive instead of additive. It's sometimes useful to manually compensate some dark corners.

  • Specular: Affects the intensity of the specular blob in objects affected by this light. At zero, this light becomes a pure diffuse light.

  • Bake Mode: Sets the bake mode for the light. See Using Lightmap global illumination.

  • Cull Mask: Objects that are in the selected layers below will be affected by this light. Note that objects disabled via this cull mask will still cast shadows. If you don't want disabled objects to cast shadows, adjust the Cast Shadow property on the GeometryInstance3D to the desired value.

See also

See Physical light and camera units if you wish to use real world units to configure your lights' intensity and color temperature.

Light number limits

When using the Forward+ renderer, Godot uses a clustering approach for real-time lighting. As many lights as desired can be added (as long as performance allows). However, there's still a default limit of 512 clustered elements that can be present in the current camera view. A clustered element is an omni light, a spot light, a decal or a reflection probe. This limit can be increased by adjusting the Rendering > Limits > Cluster Builder > Max Clustered Elements advanced project setting.

When using the Forward Mobile renderer, there is a limitation of 8 OmniLights + 8 SpotLights per mesh resource. There is also a limit of 256 OmniLights + 256 SpotLights that can be rendered in the current camera view. These limits currently cannot be changed.

When using the Compatibility renderer, up to 8 OmniLights + 8 SpotLights can be rendered per mesh resource. This limit can be increased in the advanced Project Settings by adjusting Rendering > Limits > OpenGL > Max Renderable Lights and/or Rendering > Limits > OpenGL > Max Lights Per Object