Skip to content

Search

Tilbage
· 1 min. læsning

2D lights and shadows

light2d and occluder2d build a light map every sprite, polygon and tile is multiplied by, with shadows from the shapes a node has.

light2d and occluder2d build a light map every sprite, polygon and tile is multiplied by. Shadows come from the shapes a node has.

  • light2d is point or directional, with color, radius, intensity and shadows. A point light fades quadratically to zero at radius, and unlit parts fall to the camera's ambient.

  • An occluder2d left empty follows the node's collider2d, or its circle, capsule, rect or sprite. A directional light casts parallel shadows.

    Three occluders under one directional light, each casting a parallel strip

  • post = ["bloom"] on the camera picks up an intensity past 1. ssao, ssr and dof are the 3D passes.

  • In the editor, a Lights chip draws every light's reach and every occluder's resolved outline, and the Polygon tool traces an occluder in Points mode.

    The editor with an occluder selected: the Points chip, an Occluder section, light gizmos over the lit scene

[nodes.light2d]
kind = "point"
color = "#ffd28a"
radius = 8.0
intensity = 1.6
shadows = true

Lights are outside the simulation. A scene with no light2d adds no pass. A frame draws at most 64 lights. Rendering has the rest.