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.

Methods

float

get_param ( Param param ) const

void

set_param ( Param param, float value )

Enumerations

enum Param:


enum BakeMode:

  • BAKE_DISABLED = 0 --- Light is ignored when baking.

Note: Hiding a light does not affect baking.

  • BAKE_DYNAMIC = 1

  • BAKE_STATIC = 2

Property Descriptions

Default

false

Setter

set_editor_only(value)

Getter

is_editor_only()

If true, the light only appears in the editor and will not be visible at runtime.


  • float light_angular_distance

Default

0.0

Setter

set_param(value)

Getter

get_param()

The light's angular size in degrees. Increasing this will make shadows softer at greater distances. Only available for DirectionalLight3Ds. For reference, the Sun from the Earth is approximately 0.5.


Default

1

Setter

set_bake_mode(value)

Getter

get_bake_mode()

The light's bake mode. See BakeMode.


Default

Color(1, 1, 1, 1)

Setter

set_color(value)

Getter

get_color()

The light's color. An overbright color can be used to achieve a result equivalent to increasing the light's light_energy.


  • int light_cull_mask

Default

4294967295

Setter

set_cull_mask(value)

Getter

get_cull_mask()

The light will affect objects in the selected layers.


Default

1.0

Setter

set_param(value)

Getter

get_param()

The light's strength multiplier (this is not a physical unit). For OmniLight3D and SpotLight3D, changing this value will only change the light color's intensity, not the light's radius.


  • float light_indirect_energy

Default

1.0

Setter

set_param(value)

Getter

get_param()

Secondary multiplier used with indirect light (light bounces). Used with VoxelGI and SDFGI (see Environment.sdfgi_enabled).

Note: This property is ignored if light_energy is equal to 0.0, as the light won't be present at all in the GI shader.


  • bool light_negative

Default

false

Setter

set_negative(value)

Getter

is_negative()

If true, the light's effect is reversed, darkening areas and casting bright shadows.


Setter

set_projector(value)

Getter

get_projector()

Texture2D projected by light. shadow_enabled must be on for the projector to work. Light projectors make the light appear as if it is shining through a colored but transparent object, almost like light shining through stained-glass.


Default

0.0

Setter

set_param(value)

Getter

get_param()

The size of the light in Godot units. Only available for OmniLight3Ds and SpotLight3Ds. Increasing this value will make the light fade out slower and shadows appear blurrier. This can be used to simulate area lights to an extent.


Default

0.5

Setter

set_param(value)

Getter

get_param()

The intensity of the specular blob in objects affected by the light. At 0, the light becomes a pure diffuse light. When not baking emission, this can be used to avoid unrealistic reflections when placing lights above an emissive surface.


Default

0.2

Setter

set_param(value)

Getter

get_param()

Used to adjust shadow appearance. Too small a value results in self-shadowing ("shadow acne"), while too large a value causes shadows to separate from casters ("peter-panning"). Adjust as needed.


Default

1.0

Setter

set_param(value)

Getter

get_param()

Blurs the edges of the shadow. Can be used to hide pixel artifacts in low-resolution shadow maps. A high value can impact performance, make shadows appear grainy and can cause other unwanted artifacts. Try to keep as near default as possible.


Default

Color(0, 0, 0, 1)

Setter

set_shadow_color(value)

Getter

get_shadow_color()

The color of shadows cast by this light.


  • bool shadow_enabled

Default

false

Setter

set_shadow(value)

Getter

has_shadow()

If true, the light will cast shadows.


Default

0.1

Setter

set_param(value)

Getter

get_param()


  • float shadow_normal_bias

Default

1.0

Setter

set_param(value)

Getter

get_param()

Offsets the lookup into the shadow map by the object's normal. This can be used to reduce self-shadowing artifacts without using shadow_bias. In practice, this value should be tweaked along with shadow_bias to reduce artifacts as much as possible.


  • bool shadow_reverse_cull_face

Default

false

Setter

set_shadow_reverse_cull_face(value)

Getter

get_shadow_reverse_cull_face()

If true, reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double-sided shadows with GeometryInstance3D.SHADOW_CASTING_SETTING_DOUBLE_SIDED.


  • float shadow_transmittance_bias

Default

0.05

Setter

set_param(value)

Getter

get_param()

Method Descriptions

Returns the value of the specified Param parameter.


Sets the value of the specified Param parameter.