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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
test(render): a Y-up sun's shadow falls where its direction puts it
esenginef53c17b99e18
diff --git a/fixtures/scenes/mesh-shadow-yup.esscene b/fixtures/scenes/mesh-shadow-yup.esscenenew file mode 100644index 000000000..dc46acf72--- /dev/null+++ b/fixtures/scenes/mesh-shadow-yup.esscene@@ -0,0 +1,172 @@+{+ "version": 4,+ "name": "MeshShadowYUp",+ "entities": [+ {+ "id": 0,+ "name": "Camera",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -150.0,+ "y": 260.0,+ "z": 260.0+ },+ "rotation": {+ "w": 0.8963317066047576,+ "x": -0.316678121858697,+ "y": -0.2926043897956301,+ "z": -0.1033784791113607+ }+ }+ },+ {+ "type": "Camera",+ "data": {+ "projectionType": 0,+ "fov": 45.0,+ "nearPlane": 10,+ "farPlane": 3000,+ "isActive": true,+ "priority": 0+ }+ }+ ]+ },+ {+ "id": 1,+ "name": "Ground",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 0+ },+ "rotation": {+ "w": 0.7071067811865476,+ "x": -0.7071067811865476,+ "y": 0,+ "z": 0+ },+ "scale": {+ "x": 800,+ "y": 800,+ "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,+ "cullBackfaces": false+ }+ }+ ]+ },+ {+ "id": 2,+ "name": "Board",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 100,+ "z": 0+ },+ "rotation": {+ "w": 0.7071067811865476,+ "x": 0,+ "y": -0.7071067811865476,+ "z": 0+ },+ "scale": {+ "x": 40,+ "y": 200,+ "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,+ "cullBackfaces": false+ }+ }+ ]+ },+ {+ "id": 3,+ "name": "Sun",+ "parent": null,+ "children": [],+ "visible": true,+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 0+ }+ }+ },+ {+ "type": "Light",+ "data": {+ "type": 1,+ "color": {+ "r": 1,+ "g": 1,+ "b": 1,+ "a": 1+ },+ "intensity": 1,+ "direction": {+ "x": -0.3244428422615251,+ "y": -0.8111071056538127+ },+ "directionZ": 0.4866642633922876,+ "meshShadows": true+ }+ }+ ]+ }+ ]+}\ No newline at end of filediff --git a/tools/renderScenes.mjs b/tools/renderScenes.mjsindex cccba4e4f..5b7d82046 100644--- a/tools/renderScenes.mjs+++ b/tools/renderScenes.mjs@@ -239,6 +239,9 @@ export const SCENES = [// shadow to world +200, where a depth of -1 puts it at +50. Measured: the probe// at 0.833 reads 247 at depth -1 and 0 at this one.{ id: "mesh-shadow-aimed", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/mesh-shadow-aimed.esscene", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.833,\"y\":0.5,\"rgb\":[0,0,0],\"tol\":20},{\"x\":0.167,\"y\":0.5,\"rgb\":[180,180,180],\"tol\":20},{\"x\":0.5,\"y\":0.5,\"rgb\":[180,180,180],\"tol\":20}]" } },+ // Y up, as a 3D scene is: ground in XZ, a board standing on it, a sun coming DOWN+ // with a depth component. Every gate above aims its sun in the view plane.+ { id: "mesh-shadow-yup", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/mesh-shadow-yup.esscene", ESTELLA_VERIFY_W: "512", ESTELLA_VERIFY_H: "512", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.396,\"y\":0.713,\"rgb\":[0,0,0],\"tol\":25},{\"x\":0.549,\"y\":0.891,\"rgb\":[210,210,210],\"tol\":25},{\"x\":0.598,\"y\":0.414,\"rgb\":[210,210,210],\"tol\":25}]" } },// A lamp 120 units ABOVE a panel, a height only real geometry measures against.// Hand-derived, 255·NdotL·atten: 224 under it and 101 at world +200, where the// plane's convention reads 255 and 200.