# Light 2D

> Aego 0.12.5 · development; docs build `4a32b816933e02930662f6a443cb25abe6050d090c55e237cbff5c44ae9b25f8`. [Build manifest](/docs-build.json).

```
component engine.Light2D
```

Forward 2D diffuse light. Local +X defines Spot and Directional azimuth; presentation transforms also drive shadows.

[Light2D](/ref/engine.Light2D.md) affects [SpriteRenderer](/ref/engine.SpriteRenderer.md) with `Lit` and [Mesh2D](/ref/engine.Mesh2D.md) with `LitMesh2D`. Unlit materials keep their original colour. Add a light from the Create palette, set its intensity and range in the Inspector, then drag its range and direction handles in Scene View. A handle gesture creates one Undo command.

Point lights illuminate a circle. Spot lights face local +X; `innerAngle` and `outerAngle` are full cone widths in radians, so an outer angle of π/2 spans 90°. Sprite lights apply the `cookie` texture as a mask using that texture's own region. Directional lights use node rotation for azimuth and `elevation` for the component toward the surface. Directional shadows are unavailable; enabling them produces a diagnostic.

`height` gives a local light a direction toward the receiver's normal. With a flat normal and a light exactly in the sprite plane, the diffuse dot product can be zero. Height changes shading, while occluders remain planar. Range uses world units and does not scale with the light node.

`layers` selects receiver visibility layers. `shadowCasterMask` separately selects occluder layers; neither replaces collision filtering. Eight lights can contribute to one receiver set. Priority, estimated influence and stable ID decide which lights remain when a set exceeds that budget. Scene View highlights excluded source markers and the Profiler counts exclusions and lighting batch splits. Transparent Sprite/Mesh2D order is preserved.

The Try scene places a warm light beside a cool spotlight. Change the warm light's intensity to compare its contribution, then use Reset to restore it. The lights remain still so the effect of each edit is easy to see.

## Fields

| Name | Script name | Type | Default | Description |
|---|---|---|---|---|
| Type | `Type` | `enum` | `point` | Point, Spot, Directional or Sprite/cookie. Directional shadows are not supported. |
| Color | `Color` | `Color` | `rgba(1, 1, 1, 1)` | Linear light color; the color picker handles display conversion. |
| Intensity | `Intensity` | `float` | `1` | Nonnegative energy multiplier; zero disables this light's contribution. |
| Range | `Range` | `float` | `5` | Local light radius in world units, independent of node scale. |
| Height | `Height` | `float` | `1` | Virtual distance above the sprite surface for diffuse normal mapping; shadows remain planar. |
| Inner Angle | `InnerAngle` | `float` | `0.392699` | Full Spot inner cone angle in radians, centered on local +X. |
| Outer Angle | `OuterAngle` | `float` | `0.785398` | Full Spot outer cone angle in radians, no smaller than innerAngle. |
| Elevation | `Elevation` | `float` | `0.785398` | Directional elevation above the surface in radians, greater than zero. |
| Falloff | `Falloff` | `float` | `2` | Nonnegative falloff exponent over normalized local-light distance. |
| Cookie | `Cookie` | `Texture` | `none` | Sprite light mask texture. Its own region and trim map to the light square. |
| Layers | `Layers` | `int` | `-1` | 64-bit receiver visibility mask. -1 means all bits; zero receives no objects. |
| Shadow Caster Mask | `ShadowCasterMask` | `int` | `-1` | 64-bit shadow-occluder mask, independent of visibility and collision masks. |
| Shadows | `Shadows` | `bool` | `false` | Enable cached local-light shadow masks for Point, Spot and Sprite lights. |
| Shadow Softness | `ShadowSoftness` | `float` | `0` | Bounded mask filtering radius; this is not a physical area-light penumbra. |
| Priority | `Priority` | `int` | `0` | Higher priority is selected first when the per-draw light budget is exceeded. |
