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(gates): one light casting both kinds of shadow

esenginee165379e46ad
diff --git a/desktop b/desktop
index 60623cfdd..3555d6c7c 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 60623cfddb1714a0364e8bb9e5ba3a9c2472d3a6
+Subproject commit 3555d6c7c5fabe65fe95ed6f54f9c9e064579168
diff --git a/fixtures/scenes/shadow-both.esscene b/fixtures/scenes/shadow-both.esscene
new file mode 100644
index 000000000..c7a3c616f
--- /dev/null
+++ b/fixtures/scenes/shadow-both.esscene
@@ -0,0 +1,211 @@
+{
+ "version": 4,
+ "name": "Main",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 200
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 1,
+ "orthoSize": 300,
+ "isActive": true,
+ "priority": 0
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Ground",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -200,
+ "y": 0,
+ "z": -200
+ },
+ "scale": {
+ "x": 400,
+ "y": 400,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "/scenes/shadow-quad.esmesh",
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Blocker",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -200,
+ "y": 0,
+ "z": -150
+ },
+ "scale": {
+ "x": 40,
+ "y": 40,
+ "z": 1
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "/scenes/shadow-quad.esmesh",
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "lit": true,
+ "opaque": true,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Lit",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 200,
+ "y": 0,
+ "z": -100
+ }
+ }
+ },
+ {
+ "type": "Sprite",
+ "data": {
+ "size": {
+ "x": 300,
+ "y": 300
+ },
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "material": "/scenes/mat-lit/lit.esmaterial"
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Wall",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 150,
+ "y": 0,
+ "z": -100
+ }
+ }
+ },
+ {
+ "type": "ShadowCaster2D",
+ "data": {
+ "size": {
+ "x": 30,
+ "y": 200
+ },
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Light",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 100
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 0,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 1,
+ "radius": 900,
+ "shadowSoftness": 0,
+ "meshShadows": true
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/fixtures/scenes/shadow-both.textures.json b/fixtures/scenes/shadow-both.textures.json
new file mode 100644
index 000000000..0967ef424
--- /dev/null
+++ b/fixtures/scenes/shadow-both.textures.json
@@ -0,0 +1 @@
+{}
diff --git a/tools/renderScenes.mjs b/tools/renderScenes.mjs
index ece0a6b83..9cada54aa 100644
--- a/tools/renderScenes.mjs
+++ b/tools/renderScenes.mjs
@@ -560,6 +560,10 @@ export const SCENES = [
// material sampler — so a recovered material sampling every texture from unit
// 0 looked exactly like one with no normal map, and nothing could tell.
{ id: "device-loss-material", tier: "pr", env: { ESTELLA_VERIFY_DEVICE_LOSS: "1", ESTELLA_VERIFY_SCENE: "/scenes/mat-lit-normal.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/mat-lit-normal.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.333,\"y\":0.5,\"rgb\":[0,252,0],\"tol\":45},{\"x\":0.667,\"y\":0.5,\"rgb\":[0,36,0],\"tol\":50}]" } },
+ // One light casting BOTH kinds of shadow, which the component says it can: a map
+ // over the mesh on the left, the 2D mask over the sprite on the right. Two
+ // separate paths through one frame, and nothing else asks them to coexist.
+ { id: "shadow-both-kinds", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/shadow-both.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/shadow-both.textures.json", ESTELLA_VERIFY_W: "600", ESTELLA_VERIFY_H: "600", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.10,\"y\":0.50,\"rgb\":[0,0,0],\"tol\":30},{\"x\":0.30,\"y\":0.50,\"rgb\":[153,153,153],\"tol\":40},{\"x\":0.62,\"y\":0.50,\"rgb\":[234,234,234],\"tol\":40},{\"x\":0.78,\"y\":0.50,\"rgb\":[0,0,0],\"tol\":30}]" } },
// A hundred occluders and four lights with width, which the analytic path could not
// have held: the counters are the capacity, the criteria above are the correctness.
// 0.64ms of a frame here against 0.057ms with the casters off.