Lighting Environment 2D
Lighting and output policy for a camera. An empty camera applies to the current output; overlapping environments are an error.
LightingEnvironment2D supplies ambient colour and intensity, exposure, Auto/LDR/HDR, mask resolution and the local-shadow budget. Set camera to target one Camera2D, or leave it empty to apply to the world's 2D outputs. Several matching environments produce a diagnostic; their order never chooses a winner. Without an environment, white ambient with intensity one preserves compatible Lit defaults.
LDR uses a linear RGBA8 scene target. HDR uses a verified renderable RGBA16F target and a display resolve. Auto chooses HDR when the output needs lighting and the device supports it. If the actual framebuffer cannot be used, the Inspector reports the LDR fallback reason. The UI and editor overlays stay outside scene tone mapping. A camera with an active Bloom pass filters the composed scene before this display transform.
Scene View has its own output, not the identity of a game camera. Select Preview in Scene View in an environment's Inspector to preview that environment explicitly. Changes to its fields become visible immediately. Use scene environment defaults clears the preview selection. The selection is per document and does not alter camera references, prefabs, Play state or Undo history. Deleting or disabling the selected environment preserves its preview ID and reports a diagnostic until it is restored or the selection is reset.
The Scene View toolbar can bypass lighting or display transformed normals and shadow visibility. These controls affect that view only. For a transparent HDR output, resolve preserves the premultiplied colour contract. Additive emission must first be composed into an opaque backdrop, or retained in a linear RGBA16F intermediate, before a display image is produced. Additive RGB preserves destination alpha.
component engine.LightingEnvironment2D
On this page
Usage
Add it with Create → Lighting → Lighting Environment.
Try it
Ambient illumination
The environment provides background light in addition to the local lights on the Lit surface.
Increase Ambient Intensity from 0.12 to 1 to brighten the scene; Reset restores the darker ambient.
Scene6 nodes
Scriptmain.aes
package demo
import "aego/math"
// A deterministic presentation-only motion makes the shadow response visible.
script MovingLight {
@export var Speed float = 0.8
@export var Distance float = 1.3
var elapsed float
var origin Vec2
func Ready() {
origin = node.Transform2D().Position
}
func Update(dt float) {
elapsed += dt
transform := node.Transform2D()
transform.Position = origin + Vec2{math.Cos(elapsed * Speed) * Distance, math.Sin(elapsed * Speed) * 0.8}
node.SetTransform2D(transform)
}
}
Fields
| Name | Type | Default | Description |
|---|---|---|---|
| Camera | NodeRef | none | Optional Camera2D node. Empty applies to all 2D views of this world. |
| Ambient Color | Color | rgba(1, 1, 1, 1) | Linear ambient surface illumination. Default white preserves unlit-looking Lit scenes with no lights. |
| Ambient Intensity | float | 1 | Nonnegative ambient energy multiplier. ≥ 0 |
| Color Mode | enum | auto | Auto chooses supported HDR for Lit output; LDR uses RGBA8 and HDR requests RGBA16F. one of: auto, ldr, hdr |
| Exposure | float | 1 | Positive display-resolve exposure, without changing UI or simulation. ≥ 0.001 |
| Shadow Resolution | int | 256 | Power-of-two mask dimension between 64 and 2048. Initial profile uses 256. 64 – 2048 |
| Max Shadowed Lights | int | 8 | Per-camera local-shadow budget from 0 through 16; actual performance depends on the GPU. 0 – 16 |
Related guides
- Art Studio: drawing, frames and source files Create a drawing, edit layers and frames, then distinguish saving its source from publishing game assets.
- Cameras Camera2D renders an orthographic view from the node's 2D transform.
- Materials and shaders A material is a shared asset.