feat(light): render-quality tiers 3-4 — cones, falloff, soft shadows, gels, normals, day/night (#49)
The remaining lighting tiers from the original proposal, all extending the deterministic accumulation core (light.ludic) — no new ECS plumbing: - Light.spot: cone / flashlight lights (direction + spread degrees), with a self-contained integer atan2-in-degrees and a feathered edge. - Light.falloff: a brightness-ramp exponent (1 linear, 2 quadratic, …) via repeated fixed multiply. - Light.soft: soft shadows — an area-sampled light so an occluder edge fades through a penumbra instead of a hard cut. - Light.gel + Light.clear_gel: colour cookies — a light gels from its centre colour to a rim colour. - Light.normal + Light.clear_normals + Light.height: a normal G-buffer so surfaces shade by facing (N·L), not distance alone (tier 3). - Light.time_of_day: a day/night ambient ramp from a single 0..1 value. The engine lighting system (systems_light.ludic) consumes matching optional Light2D fields — direction/spread/falloff/softness/gel — each defaulting off so an older five-field Light2D lights exactly as before. Every tier is integer + Q16.16 fixed, so scenes light identically on every run and headless. Worked example + regression: examples/library/light_tiers.ludic (1 1 1 1 1 1 1 1 1). Nine new docs/language/light pages. Full suite 76 passed, self-host C-free fixpoint intact, no golden drift. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
377b6d1186
commit
382826889f
18 changed files with 7752 additions and 6502 deletions
31
docs/language/light/light-falloff.md
Normal file
31
docs/language/light/light-falloff.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
id: light-falloff
|
||||
name: Light.falloff
|
||||
category: light
|
||||
kind: namespace-method
|
||||
tokens: Light.falloff
|
||||
sig: Light.falloff(exponent)
|
||||
tip: Set the brightness-ramp exponent for later lights (1 linear, 2 quadratic…).
|
||||
order: 6
|
||||
ns: Light
|
||||
member: falloff
|
||||
---
|
||||
|
||||
Sets the **falloff curve** applied to every light emitted after it. A light's brightness ramps from full at the centre to zero at its radius; the ramp is raised to <code>exponent</code>, so <code>1</code> is the original linear falloff, <code>2</code> is quadratic (a softer, more concentrated core), <code>3</code> cubic, and so on. Like the occluder store, the setting persists across frames until changed — a game sets it once, or per light, and it rides alongside the short <a href="light-point"><code>Light.point</code></a> / <a href="light-spot"><code>Light.spot</code></a> signatures. Integer exponent, Q16.16 ramp — deterministic.
|
||||
|
||||
Parameters:
|
||||
- `exponent` — the ramp power, an integer `>= 1` (`1` = linear, the default)
|
||||
|
||||
```ludic
|
||||
program Demo {
|
||||
property Torch { x: int = 0, y: int = 0 }
|
||||
model Lamp { Torch }
|
||||
handler Render phase Update {
|
||||
Screen.clear(0)
|
||||
Light.ambient(Color.rgb(24, 24, 32))
|
||||
Light.falloff(2) # a tighter, quadratic glow
|
||||
Light.point(80, 60, 70, Color.rgb(255, 210, 130), 1.0)
|
||||
Screen.show()
|
||||
}
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue