Aego Русский

Light Occluder 2D

A planar shadow contour. Manual polygons require no Physics module; ShapeProvider reads local geometry through the shapes2d contract.

LightOccluder2D describes shadow geometry independently of the visible sprite. Polygon uses local points; enable closed for a simple polygon without holes, or leave it off for a chain. The validator rejects non-finite points, zero-length edges and self-intersections. A sprite does not become an occluder automatically.

In Scene View, drag a vertex to move it, drag an edge midpoint to insert a vertex, or Alt-click a vertex to remove it. Each gesture uses one History transaction. ShapeProvider instead copies local geometry from a provider such as Physics, identified by shapeNode and a stable shape key. Physics is optional: the Try scene uses only a manual polygon. Changing collision masks does not change layers here.

Point, Spot and Sprite lights share the planar shadow algorithm. Overlapping volumes form a union. A light inside a closed contour is blocked by that contour; a receiver does not automatically ignore its own contour. cullMode chooses the accepted edge winding independently of a physics chain's one-sided setting. Softness filters each mask within a bounded radius and does not simulate an area light.

Offscreen casters remain eligible when their shadows reach a visible receiver. Light and occluder geometry use presentation transforms, including interpolated motion. Static light-space masks are reused while only the camera moves; moving a light or caster, changing its contour, resolution or filtering invalidates the relevant mask. The Inspector shows active mask layers with the owning light, and Scene View's shadow display shows visibility on Lit surfaces.

component engine.LightOccluder2D
On this page

Usage

Add it with Create → Lighting → Light Occluder.

Art Studio

Emission and normal channels Art Studio lessons

Try it

Light occluder layers

The rectangle casts a shadow for the warm light, whose shadow mask includes layer 1.

Change Layers from 1 to 2. The light no longer sees this occluder; Reset restores the shadow.

Starts the scene; open the example parameters to experiment.
Open in AegoDownload example project
Scene6 nodes
Camera
Transform
position[0, 0]rotation0scale[1, 1]
Camera 2D
zoomfloat54viewportRect[0, 0, 1, 1]maskint-1orderint0clearbooltrueclearColorColor#0d1420ffscaleenumfitVirtualvirtualVec2[960, 540]activebooltrue
Lit surface
Transform
position[0, 0]rotation0scale[1, 1]
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")materialAssetRef<material>asset("ae900000000000000000000000000c06")layerint0orderint0tintColor#a8bacffforiginVec2[0.5, 0.5]sizeVec2[12, 6]flipXboolfalseflipYboolfalseblendenumpremultipliedfilterenumnearest
Lighting environment
Transform
position[0, 0]rotation0scale[1, 1]
Warm point light
Transform
position[-2, -1]rotation0scale[1, 1]
Light 2D
typeenumpointcolorColor#ffbd75ffintensityfloat3.8rangefloat8heightfloat2fallofffloat1.3layersint1shadowCasterMaskint1shadowsbooltrueshadowSoftnessfloat1priorityint2
Cool spotlight
Transform
position[4, 1.2]rotation3.1415927scale[1, 1]
Light 2D
typeenumspotcolorColor#779effffintensityfloat3rangefloat9heightfloat2innerAnglefloat0.9outerAnglefloat1.6fallofffloat1.2layersint1shadowCasterMaskint1shadowsboolfalsepriorityint1
Manual occluder
Transform
position[0.7, 0]rotation0scale[1, 1]
Light Occluder 2D
sourceenumpolygonpolygon[]Vec2[[-0.18, -1.1], [0.18, -1.1], [0.18, 1.1], [-0.18, 1.1]]closedbooltruecullModeenumnonelayersint1
Sprite Renderer
spriteTextureasset("ae900000000000000000000000000010")layerint0orderint2tintColor#e3e8effforiginVec2[0.5, 0.5]sizeVec2[0.36, 2.2]blendenumpremultipliedfilterenumnearest

Fields

NameTypeDefaultDescription
Sourceenumpolygon

Use a manual polygon/chain or a registered local-shape provider.

one of: polygon, shapeProvider, spriteAlpha
Polygon[]Vec2[4 items]

Simple local-space contour without holes; points follow the owner's presentation transform once.

read-only in scripts
Closedbooltrue

Close the manual polygon. A ShapeProvider supplies each contour's closed state.

Cull Modeenumnone

Shadow edge winding policy; independent of any physics one-sided setting.

one of: none, clockwise, counterClockwise
Layersint-1

64-bit shadow participation mask. -1 is all bits; zero casts no shadows.

Shape NodeNodeRefnone

Source node for ShapeProvider. Empty uses this node; unresolved IDs are preserved.

Shapestring""

Stable provider shape key, such as physics.BoxCollider2D. Empty selects all of the source node's shapes.