Phase 5 updates

Phase 5 · Slice 16 ·

2D lights

  • Sorting layers are real: the project's TagManager layers (Unity scenes, the MCP's projects, the conformance project), with Unity's IDs (saved unsigned), names and values relative to Default; renderers sort by a layer's place in the order. An invalid sortingLayerID is refused with Unity's error.
  • A new Unity.RenderPipelines.Universal.2D.Runtime assembly: Light2D with URP's fields, defaults and clamping, target sorting layers (all by default, set in Awake), shape paths; ShadowCaster2D and CompositeShadowCaster2D as settings. Lights reach the renderer each frame before rendering (RenderPipelineManager's context callback).
  • The renderer shades sprites with URP's 2D lit shaders per pixel from the frame's 2D lights (storage buffers):
    • point and spot lights as URP's lookup texture gives them (distance within the outer radius rescaled by the inner, linear across the cone's inner and outer half angles);
    • freeform and parametric polygons, full inside and fading over their falloff size;
    • URP's falloff curve, t ^ (ln(1 - b) / ln b) with b from falloffIntensity, read back through its sRGB lookup texture;
    • each blend style's lights added (or alpha blended, by light order) over its global light; sprite × multiply styles + additive styles; unlit when no light targets the sprite's layer.
    • Light color is linear(intensity × alpha × color), made linear after scaling as URP passes it.
  • URP's package materials (Sprite-Lit-Default, Sprite-Unlit-Default, Lit, Simple Lit, Particles Unlit) resolve by GUID in Unity scenes.
  • A new lights_2d conformance scenario records the project's sorting layers, renderers moving between them, Light2D's defaults, clamping, target layer edits and shapes, and a Unity scene (NE2DScene) with a freeform light and a lit sprite on another layer. Unity records without graphics, so the shading itself is checked by GPU tests against a CPU model of URP's math. 41 scenarios pass in both runs.
  • A night version of the 2D platformer sample (platformer2d_night.json): a dim global light, torches, a spot and an additive freeform glow. An MCP e2e test covers a lit sprite under a point light, and unlit without one.
  • Not yet: Sprite (cookie) lights, normal maps, 2D shadows, volumetric light, the shape falloff offset, custom blend styles (Renderer2DData), lighting under perspective cameras (lights are evaluated in world XY).
  • Next: 2D shadows and normal maps, or agent avoidance and off-mesh links.