Up to date

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

Light3D

Inherits: VisualInstance3D < Node3D < Node < Object

Inherited By: DirectionalLight3D, OmniLight3D, SpotLight3D

Provides a base class for different kinds of light nodes.

Description

Light3D is the abstract base class for light nodes. As it can't be instantiated, it shouldn't be used directly. Other types of light nodes inherit from it. Light3D contains the common variables and parameters used for lighting.

Tutorials

Properties

float

distance_fade_begin

40.0

bool

distance_fade_enabled

false

float

distance_fade_length

10.0

float

distance_fade_shadow

50.0

bool

editor_only

false

float

light_angular_distance

0.0

BakeMode

light_bake_mode

2

Color

light_color

Color(1, 1, 1, 1)

int

light_cull_mask

4294967295

float

light_energy

1.0

float

light_indirect_energy

1.0

float

light_intensity_lumens

float

light_intensity_lux

bool

light_negative

false

Texture2D

light_projector

float

light_size

0.0

float

light_specular

0.5

float

light_temperature

float

light_volumetric_fog_energy

1.0

float

shadow_bias

0.1

float

shadow_blur

1.0

bool

shadow_enabled

false

float

shadow_normal_bias

2.0

float

shadow_opacity

1.0

bool

shadow_reverse_cull_face

false

float

shadow_transmittance_bias

0.05

Methods

Color

get_correlated_color ( ) const

float

get_param ( Param param ) const

void

set_param ( Param param, float value )


Enumerations

enum Param:

Param PARAM_ENERGY = 0

Constant for accessing light_energy.

Param PARAM_INDIRECT_ENERGY = 1

Constant for accessing light_indirect_energy.

Param PARAM_VOLUMETRIC_FOG_ENERGY = 2

Constant for accessing light_volumetric_fog_energy.

Param PARAM_SPECULAR = 3

Constant for accessing light_specular.

Param PARAM_RANGE = 4

Constant for accessing OmniLight3D.omni_range or SpotLight3D.spot_range.

Param PARAM_SIZE = 5

Constant for accessing light_size.

Param PARAM_ATTENUATION = 6

Constant for accessing OmniLight3D.omni_attenuation or SpotLight3D.spot_attenuation.

Param PARAM_SPOT_ANGLE = 7

Constant for accessing SpotLight3D.spot_angle.

Param PARAM_SPOT_ATTENUATION = 8

Constant for accessing SpotLight3D.spot_angle_attenuation.

Param PARAM_SHADOW_MAX_DISTANCE = 9

Constant for accessing DirectionalLight3D.directional_shadow_max_distance.

Param PARAM_SHADOW_SPLIT_1_OFFSET = 10

Constant for accessing DirectionalLight3D.directional_shadow_split_1.

Param PARAM_SHADOW_SPLIT_2_OFFSET = 11

Constant for accessing DirectionalLight3D.directional_shadow_split_2.

Param PARAM_SHADOW_SPLIT_3_OFFSET = 12

Constant for accessing DirectionalLight3D.directional_shadow_split_3.

Param PARAM_SHADOW_FADE_START = 13

Constant for accessing DirectionalLight3D.directional_shadow_fade_start.

Param PARAM_SHADOW_NORMAL_BIAS = 14

Constant for accessing shadow_normal_bias.

Param PARAM_SHADOW_BIAS = 15

Constant for accessing shadow_bias.

Param PARAM_SHADOW_PANCAKE_SIZE = 16

Constant for accessing DirectionalLight3D.directional_shadow_pancake_size.

Param PARAM_SHADOW_OPACITY = 17

Constant for accessing shadow_opacity.

Param PARAM_SHADOW_BLUR = 18

Constant for accessing shadow_blur.

Param PARAM_TRANSMITTANCE_BIAS = 19

Constant for accessing shadow_transmittance_bias.

Param PARAM_INTENSITY = 20

Constant for accessing light_intensity_lumens and light_intensity_lux. Only used when ProjectSettings.rendering/lights_and_shadows/use_physical_light_units is true.

Param PARAM_MAX = 21

Represents the size of the Param enum.


enum BakeMode:

BakeMode BAKE_DISABLED = 0

Light is ignored when baking. This is the fastest mode, but the light will be taken into account when baking global illumination. This mode should generally be used for dynamic lights that change quickly, as the effect of global illumination is less noticeable on those lights.

Note: Hiding a light does not affect baking LightmapGI. Hiding a light will still affect baking VoxelGI and SDFGI (see [member Environment.sdfgi_enabled).

BakeMode BAKE_STATIC = 1

Light is taken into account in static baking (VoxelGI, LightmapGI, SDFGI (Environment.sdfgi_enabled)). The light can be moved around or modified, but its global illumination will not update in real-time. This is suitable for subtle changes (such as flickering torches), but generally not large changes such as toggling a light on and off.

Note: The light is not baked in LightmapGI if editor_only is true.

BakeMode BAKE_DYNAMIC = 2

Light is taken into account in dynamic baking (VoxelGI and SDFGI (Environment.sdfgi_enabled) only). The light can be moved around or modified with global illumination updating in real-time. The light's global illumination appearance will be slightly different compared to