Class reference

Light2D

Inherits Node2D

Casts light in a 2D environment.

Description

Casts light in a 2D environment. A light is defined as a color, an energy value, a mode (see constants), and various other parameters (range and shadows-related).

Properties

int blend_mode = 0

The Light2D's blend mode.

Color color = Color(1, 1, 1, 1)

The Light2D's Color.

bool editor_only = false

If true, Light2D will only appear when editing the scene.

bool enabled = true

If true, Light2D will emit light.

float energy = 1.0

The Light2D's energy value. The larger the value, the stronger the light.

int range_layer_max = 0

Maximum layer value of objects that are affected by the Light2D.

int range_layer_min = 0

Minimum layer value of objects that are affected by the Light2D.

int range_z_max = 1024

Maximum z value of objects that are affected by the Light2D.

int range_z_min = -1024

Minimum z value of objects that are affected by the Light2D.

Color shadow_color = Color(0, 0, 0, 0)

Color of shadows cast by the Light2D.

bool shadow_enabled = false

If true, the Light2D will cast shadows.

int shadow_filter = 0

Shadow filter type.

Methods

Constants

SHADOW_FILTER_NONE = 0

Enum: ShadowFilter

No filter applies to the shadow map. This provides hard shadow edges and is the fastest to render. See shadow_filter.

SHADOW_FILTER_PCF5 = 1

Enum: ShadowFilter

Percentage closer filtering (5 samples) applies to the shadow map. This is slower compared to hard shadow rendering. See shadow_filter.

SHADOW_FILTER_PCF13 = 2

Enum: ShadowFilter

Percentage closer filtering (13 samples) applies to the shadow map. This is the slowest shadow filtering mode, and should be used sparingly. See shadow_filter.

BLEND_MODE_ADD = 0

Enum: BlendMode

Adds the value of pixels corresponding to the Light2D to the values of pixels under it. This is the common behavior of a light.

BLEND_MODE_SUB = 1

Enum: BlendMode

Subtracts the value of pixels corresponding to the Light2D to the values of pixels under it, resulting in inversed light effect.

BLEND_MODE_MIX = 2

Enum: BlendMode

Mix the value of pixels corresponding to the Light2D to the values of pixels under it by linear interpolation.

Tutorials

Source revision 4f5b14abade2
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.