Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

test(render): sun-shadow pins the whole penumbra ramp, not just its ends

yhh9c48947fe905
diff --git a/CHANGELOG.md b/CHANGELOG.md
index efdb8f8cb..fa302f280 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,24 @@ published separately; it ships inside the editor.
### Changed
+- **Every rasterizer draws the same penumbra, and `sun-shadow` now says so.** A
+ sample step of disagreement on a wide sun disc had been recorded rather than
+ hidden — the gate carried tolerances wide enough to hold whichever rasterizer
+ ran, and its comment said as much. Re-measured on all three: webgl2, webgpu and
+ the software rasterizer CI runs on read the ramp `0 / 70 / 116 / 170 / 209 / 247`
+ to the value. The shadow-pass work is the only thing that has touched where an
+ ortho map lands in the atlas since, so that is where the credit goes.
+
+ So the tolerance sized to that divergence was the thing left to fix: it was
+ hiding a real invariant. The gate pins the whole ramp now — the two midpoints
+ are new — at ±10 instead of ±35 and ±25.
+
+ What that buys, measured by sabotaging the fixture rather than argued: a sun a
+ quarter narrower (`sourceAngle` 5.6 → 4.2) reshapes the penumbra to
+ `0 / 46 / 116 / 186 / 224 / 247` and **the old gate passes it** — every probe it
+ had stayed inside tolerance. The new one fails at two points. A third wider
+ (7.5) is caught squarely in the ramp rather than by the umbra probe alone.
+
- **A new 3D project starts in linear light with an ACES output transform.** The
`3d-starter` template ships `rendering.colorSpace: linear` and
`rendering.outputTransform: aces`, and its two lights are re-authored for that
diff --git a/tools/renderScenes.mjs b/tools/renderScenes.mjs
index 654678b3e..747f8b3f3 100644
--- a/tools/renderScenes.mjs
+++ b/tools/renderScenes.mjs
@@ -124,10 +124,12 @@ export const SCENES = [
{ id: "point-shadow-pair", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/point-shadow-pair.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_COUNTERS: "{\"render.shadow.tiles\":10,\"render.shadow.draws\":10}", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.15,\"y\":0.5,\"rgb\":[66,66,66],\"tol\":20},{\"x\":0.85,\"y\":0.5,\"rgb\":[66,66,66],\"tol\":20},{\"x\":0.25,\"y\":0.5,\"rgb\":[220,220,220],\"tol\":25},{\"x\":0.5,\"y\":0.5,\"rgb\":[255,255,255],\"tol\":20}]" } },
// A SUN WITH A SIZE: its source is infinitely far away, so what it carries is an angle
// and not a length — the penumbra is tan(sourceAngle/2) times how far the caster stands
- // above what it falls on. One expectation for both backends: a real WebGPU driver lands
- // on the WebGL2 values exactly, and SwiftShader's ramp sits a sample step along, inside
- // the tolerance either way.
- { id: "sun-shadow", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/sun-shadow.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.62,\"y\":0.5,\"rgb\":[0,0,0],\"tol\":20},{\"x\":0.66,\"y\":0.5,\"rgb\":[70,70,70],\"tol\":35},{\"x\":0.72,\"y\":0.5,\"rgb\":[209,209,209],\"tol\":25},{\"x\":0.85,\"y\":0.5,\"rgb\":[247,247,247],\"tol\":20}]" } },
+ // above what it falls on.
+
+ // The whole ramp, not just its ends: what the probes pin is the SHAPE of that penumbra,
+ // which is where a sun of the wrong angular size shows. One expectation for every
+ // rasterizer — webgl2, webgpu and SwiftShader read these to the value.
+ { id: "sun-shadow", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/sun-shadow.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.62,\"y\":0.5,\"rgb\":[0,0,0],\"tol\":20},{\"x\":0.66,\"y\":0.5,\"rgb\":[70,70,70],\"tol\":10},{\"x\":0.68,\"y\":0.5,\"rgb\":[116,116,116],\"tol\":10},{\"x\":0.7,\"y\":0.5,\"rgb\":[170,170,170],\"tol\":10},{\"x\":0.72,\"y\":0.5,\"rgb\":[209,209,209],\"tol\":10},{\"x\":0.85,\"y\":0.5,\"rgb\":[247,247,247],\"tol\":20}]" } },
// The same scene with the caster moved DOWN the sun's own ray: its shadow lands where it
// did and the edge sharpens by the ratio of the distances. Two of these four probes
// differ from the gate above by 70 and 38, which a fixed blur could not produce.