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
fix(render): what is nearer is measured from the viewer, not read off world z
yhhb829c9441904
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 60bfd09c6..b5d270abd 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,60 @@ published separately; it ships inside the editor.### Changed+- **What is nearer is measured from the viewer, not read off world z.** Every+ renderable handed the sort key its world z as depth, and the key's own comment+ said why that worked: the camera looks down -Z, so a larger z is nearer. That+ sentence stopped being true when the eye learned to turn. A scene seen from an+ orbited editor view or a tilted camera still ordered its blended draws by an+ axis pointing somewhere else, and blended draws are exactly the ones with no+ depth buffer to fall back on — they do not write depth, by design, because+ writing is what clips translucent sprites into black edges. So the frame+ composited in the wrong order and nothing anywhere said so.++ `CameraView::viewDepth` is that measurement now, derived once per collect+ beside the world rect the plugins already share. An orthographic camera has no+ eye point, so it projects onto the direction pointing at the viewer — head-on+ that direction is exactly +Z and the answer is `worldPos.z` to the bit, which+ is why every 2D scene renders identically. A perspective one answers with the+ distance to the eye, negated to keep larger meaning nearer.++ Where the viewer is has one answer for the whole engine now.+ `cameraFromViewProjection` moved to `FrameConstants.hpp`, next to the field it+ fills, and both the shaders' view vector and the CPU's ordering read it — the+ two cannot disagree about where the eye is. A tilemap layer keeps its authored+ depth: it is flat content stacked by a number it carries, not a world point+ anything can measure.++ Gate `sort-view-depth`, both backends: two blended quads side by side in X at+ the same world z, the far one submitted last, seen from an eye turned -60°+ about Y. Equal world z ties, and the tie hands the frame to the far quad. None+ of the sixty-six pixel gates that already existed could fail this — head-on the+ old rule and the new one agree, which is precisely why it survived so long.++- **A turned model is culled by a box that turned with it.** The mesh cull scaled+ a local AABB into world space and ignored the rotation, which a flat sprite can+ afford and a model cannot: the bound it produces is smaller than the geometry it+ is meant to contain, so a mesh rotated about anything but the view axis vanished+ while part of it was still on screen. Each world axis takes `|R| * halfExtents`+ now, which is exact for a box and costs nine multiplies. An unrotated entity+ gets the same box it got before. `EntityBox` became oriented last week for the+ hit test; this is the same fact, on the side that decides what draws.++- **The renderer has one camera, and the SDK owns it.** `renderFrame` resolved a+ camera of its own in C++: it built the view from `inverse(translate(position))`,+ so it ignored the entity's rotation, read the local position rather than the+ world one (a parented camera pointed at the wrong place), took the first active+ camera it iterated past rather than the one with the priority, and knew nothing+ of viewport, culling mask or pixel-perfect snapping. Nothing called it —+ `buildCameraInfo` on the SDK side has been the real path throughout — but it was+ bound on both hosts and it was the first thing a search for the camera found.+ A second implementation of a thing, kept wrong and reachable, is a trap for+ whoever extends it next; it is gone.++- **GL states the depth function its second backend states.** `GLDevice::init`+ enabled the depth test and never set the compare, matching WebGPU's `Less` only+ because that is also GL's default. The rule is written down on both sides now.+- **A light aims where its entity is turned.** A light carried its own aim —`direction` in the plane and a `directionZ` bolted on beside it — and the entity'srotation meant nothing to the renderer. So rotating a light did nothing, a torchdiff --git a/desktop/public/scenes/sort-view-depth.esscene b/desktop/public/scenes/sort-view-depth.esscenenew file mode 100644index 000000000..d95f45eb9--- /dev/null+++ b/desktop/public/scenes/sort-view-depth.esscene@@ -0,0 +1,39 @@+{+ "version": 1,+ "name": "SortViewDepth",+ "entities": [+ {+ "id": 0,+ "name": "Camera",+ "parent": null,+ "children": [],+ "components": [+ { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 300 } } },+ { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }+ ],+ "visible": true+ },+ {+ "id": 1,+ "name": "Green",+ "parent": null,+ "children": [],+ "components": [+ { "type": "Transform", "data": { "position": { "x": -60, "y": 0, "z": 0 } } },+ { "type": "ShapeRenderer", "data": { "shapeType": 0, "size": { "x": 400, "y": 400 }, "color": { "r": 0, "g": 1, "b": 0, "a": 1 }, "enabled": true } }+ ],+ "visible": true+ },+ {+ "id": 2,+ "name": "Red",+ "parent": null,+ "children": [],+ "components": [+ { "type": "Transform", "data": { "position": { "x": 60, "y": 0, "z": 0 } } },+ { "type": "ShapeRenderer", "data": { "shapeType": 0, "size": { "x": 400, "y": 400 }, "color": { "r": 1, "g": 0, "b": 0, "a": 1 }, "enabled": true } }+ ],+ "visible": true+ }+ ]+}diff --git a/desktop/public/scenes/sort-view-depth.textures.json b/desktop/public/scenes/sort-view-depth.textures.jsonnew file mode 100644index 000000000..0967ef424--- /dev/null+++ b/desktop/public/scenes/sort-view-depth.textures.json@@ -0,0 +1 @@+{}diff --git a/src/esengine/renderer/RenderTypePlugin.hpp b/src/esengine/renderer/RenderTypePlugin.hppindex bcdbf667b..c581012d7 100644--- a/src/esengine/renderer/RenderTypePlugin.hpp+++ b/src/esengine/renderer/RenderTypePlugin.hpp@@ -4,6 +4,7 @@#include "../core/Types.hpp"#include "./frame/RenderStage.hpp"+#include "./frame/FrameConstants.hpp"#include "./draw/RenderItem.hpp"#include "./draw/DrawCommand.hpp"#include "./draw/DrawList.hpp"@@ -41,25 +42,43 @@ struct RenderFrameContext {u32 environment_texture_id = 0;};-/** @brief The camera's view bounds in world space, derived once per collect from the- * inverse view-projection — the single source for every plugin's parallax and- * world-rect culling math (previously re-derived inside each plugin). */-struct CameraWorldRect {+/** @brief What every plugin needs to know about the camera, derived once per collect+ * from the inverse view-projection — the single source for parallax, world-rect+ * culling and the depth draws are sorted by (each previously re-derived, or in+ * the depth's case assumed, inside the plugins). */+struct CameraView {f32 left = 0.0f, bottom = 0.0f, right = 0.0f, top = 0.0f;glm::vec2 center{0.0f};++ /// Where the frame is seen from, in FrameConstants::camera's convention: the+ /// eye's world position when w = 1, or the unit direction pointing at the+ /// viewer when w = 0. From cameraFromViewProjection, as the shaders' copy is.+ glm::vec4 eye{0.0f, 0.0f, 1.0f, 0.0f};++ /**+ * @brief How near @p worldPos is to the viewer, larger = nearer — the order the+ * sort key wants, and the one world z gives only while the camera looks+ * down -Z. Orthographic projects onto the viewer direction (head-on that+ * is worldPos.z exactly); perspective answers with -distance to the eye.+ */+ f32 viewDepth(const glm::vec3& worldPos) const {+ if (eye.w < 0.5f) return glm::dot(worldPos, glm::vec3(eye));+ return -glm::length(worldPos - glm::vec3(eye));+ }};-inline CameraWorldRect computeCameraWorldRect(const glm::mat4& viewProjection) {+inline CameraView computeCameraView(const glm::mat4& viewProjection) {glm::mat4 invVP = glm::inverse(viewProjection);glm::vec4 bl = invVP * glm::vec4(-1.0f, -1.0f, 0.0f, 1.0f);glm::vec4 tr = invVP * glm::vec4( 1.0f, 1.0f, 0.0f, 1.0f);- CameraWorldRect rect;- rect.left = bl.x / bl.w;- rect.bottom = bl.y / bl.w;- rect.right = tr.x / tr.w;- rect.top = tr.y / tr.w;- rect.center = { (rect.left + rect.right) * 0.5f, (rect.bottom + rect.top) * 0.5f };- return rect;+ CameraView view;+ view.left = bl.x / bl.w;+ view.bottom = bl.y / bl.w;+ view.right = tr.x / tr.w;+ view.top = tr.y / tr.w;+ view.center = { (view.left + view.right) * 0.5f, (view.bottom + view.top) * 0.5f };+ view.eye = cameraFromViewProjection(viewProjection);+ return view;}struct RenderCollectContext {@@ -69,14 +88,14 @@ struct RenderCollectContext {TransientBufferPool& buffer_pool;DrawList& draw_list;RenderFrameContext& frame_context;- CameraWorldRect camera;+ CameraView camera;};/** @brief Decomposes @p transform and returns its world position shifted toward the* camera by (1 - parallax); factor 1 = no shift, 0 = screen-pinned. Applied* before the frustum cull so a parallaxed renderable is culled where drawn. */inline glm::vec3 parallaxedWorldPosition(ecs::Transform& transform, const glm::vec2& parallax,- const CameraWorldRect& camera) {+ const CameraView& camera) {transform.ensureDecomposed();glm::vec3 position = transform.worldPosition;position.x += camera.center.x * (1.0f - parallax.x);diff --git a/src/esengine/renderer/draw/BatchBuilder.hpp b/src/esengine/renderer/draw/BatchBuilder.hppindex dd51a7103..5c350c4f0 100644--- a/src/esengine/renderer/draw/BatchBuilder.hpp+++ b/src/esengine/renderer/draw/BatchBuilder.hpp@@ -94,6 +94,9 @@ struct BatchDrawKey {// The frame environment's prefiltered reflection, one slot further on. Same// terms as the shadow map: per-draw, and only where a mesh vertex source asked.u32 envTextureId = 0;+ // How near the draw's anchor is to the viewer, larger = nearer —+ // CameraView::viewDepth, not a world coordinate. Only that orders blended draws+ // the way they composite once the camera has been turned off head-on.f32 depth = 0.0f;// World-space Y of the draw's anchor. Consumed only when the layer is y-sorted// (DrawList::ySortMask); layers outside 0..31 cannot y-sort.diff --git a/src/esengine/renderer/draw/DrawCommand.hpp b/src/esengine/renderer/draw/DrawCommand.hppindex ebdc3e779..4eaf4e24c 100644--- a/src/esengine/renderer/draw/DrawCommand.hpp+++ b/src/esengine/renderer/draw/DrawCommand.hpp@@ -157,12 +157,9 @@ struct DrawCommand {u64 stageKey = static_cast<u64>(stage) << 44;- // Order-preserving float mapping — monotonic over the FULL float range.- // The old [-1,1] normalize-and-truncate silently wrapped any real-world z- // (e.g. a backdrop at z=-5 sorted as if nearest), and had the painter's- // order inverted for the blended stages. Camera looks down -z, so larger- // z = nearer: transparent/overlay draw back-to-front (far first, near- // lands on top); opaque draws front-to-back (early-z friendly).+ // Order-preserving float mapping — monotonic over the FULL float range, so+ // any real-world depth sorts. `depth` is CameraView::viewDepth, larger =+ // nearer: blended back-to-front, opaque front-to-back for early-z.const bool blended = stage == RenderStage::Transparent || stage == RenderStage::Overlay;u32 orderedDepth = blended ? orderedFloatBits(depth) : ~orderedFloatBits(depth);diff --git a/src/esengine/renderer/frame/FrameConstants.hpp b/src/esengine/renderer/frame/FrameConstants.hppindex 88f01a67a..1aa8c2d00 100644--- a/src/esengine/renderer/frame/FrameConstants.hpp+++ b/src/esengine/renderer/frame/FrameConstants.hpp@@ -22,6 +22,8 @@#include <glm/glm.hpp>+#include <cmath>+namespace esengine {/**@@ -36,6 +38,22 @@ struct FrameConstants {glm::vec4 camera{0.0f, 0.0f, 1.0f, 0.0f};};+/**+ * @brief Where the frame is seen from, read out of the matrix that projects it.+ *+ * @details inverse(VP) on the clip z axis: a perspective divide brings it down to+ * the eye POINT (w = 1); orthographic has none, so it stays a DIRECTION,+ * negated to point at the viewer (w = 0). One answer for both the shaders'+ * FrameConstants::camera and the CPU's draw ordering.+ */+inline glm::vec4 cameraFromViewProjection(const glm::mat4& viewProjection) {+ const glm::vec4 axis = glm::inverse(viewProjection)[2];+ if (std::abs(axis.w) > 1e-6f) return glm::vec4(glm::vec3(axis) / axis.w, 1.0f);+ const f32 len = glm::length(glm::vec3(axis));+ if (len < 1e-12f) return glm::vec4(0.0f, 0.0f, 1.0f, 0.0f);+ return glm::vec4(-glm::vec3(axis) / len, 0.0f);+}+/** @brief Indexed uniform binding point the FrameConstants block is bound to. */inline constexpr u32 FRAME_CONSTANTS_BINDING = 0;diff --git a/src/esengine/renderer/frame/RenderContext.cpp b/src/esengine/renderer/frame/RenderContext.cppindex 7ce4732d4..cd628833a 100644--- a/src/esengine/renderer/frame/RenderContext.cpp+++ b/src/esengine/renderer/frame/RenderContext.cpp@@ -155,17 +155,6 @@ void RenderContext::initFrameUbo() {ES_LOG_DEBUG("FrameConstants UBO created (handle: {})", static_cast<u32>(frameUbo_));}-// Where the frame is seen from, read out of the matrix that projects it — every-// path in hands over a view-projection and nothing else. inverse(VP) on the clip-// z axis: perspective divides down to the eye, else negate to face the viewer.-static glm::vec4 cameraFromViewProjection(const glm::mat4& viewProjection) {- const glm::vec4 axis = glm::inverse(viewProjection)[2];- if (std::abs(axis.w) > 1e-6f) return glm::vec4(glm::vec3(axis) / axis.w, 1.0f);- const f32 len = glm::length(glm::vec3(axis));- if (len < 1e-12f) return glm::vec4(0.0f, 0.0f, 1.0f, 0.0f);- return glm::vec4(-glm::vec3(axis) / len, 0.0f);-}-void RenderContext::updateFrameConstants(const glm::mat4& viewProjection) {viewProjection_ = viewProjection;const FrameConstants frame{viewProjection, cameraFromViewProjection(viewProjection)};diff --git a/src/esengine/renderer/frame/RenderFrame.cpp b/src/esengine/renderer/frame/RenderFrame.cppindex d34755941..85d0169b6 100644--- a/src/esengine/renderer/frame/RenderFrame.cpp+++ b/src/esengine/renderer/frame/RenderFrame.cpp@@ -906,7 +906,7 @@ void RenderFrame::renderShadowMap(ecs::Registry& registry) {if (cascades == 1) {// What the map covers: the 3D geometry, unless the light asked for a fixed// reach. A radius, so coverage does not change as the light turns.- const CameraWorldRect view = computeCameraWorldRect(sceneVP);+ const CameraView view = computeCameraView(sceneVP);const f32 fitted = haveBounds? 0.5f * glm::length(boundsMax - boundsMin): 0.5f * glm::length(glm::vec2(view.right - view.left, view.top - view.bottom));@@ -990,7 +990,7 @@ void RenderFrame::renderShadowMap(ecs::Registry& registry) {auto ctx = makeContext();ctx.shadow_pass = true;RenderCollectContext collectCtx{registry, frustum_, clip_state_, pool_, draw_list_, ctx,- computeCameraWorldRect(matrices[c])};+ computeCameraView(matrices[c])};for (auto& plugin : plugins_) plugin->collect(collectCtx);draw_list_.finalize(pool_);@@ -1085,7 +1085,7 @@ void RenderFrame::collectAll(ecs::Registry& registry, u32 skipFlags) {auto ctx = makeContext();RenderCollectContext collectCtx{registry, frustum_, clip_state_, pool_, draw_list_, ctx,- computeCameraWorldRect(ctx.view_projection)};+ computeCameraView(ctx.view_projection)};collectSky(collectCtx);for (auto& plugin : plugins_) {if (skipFlags != 0 && (skipFlags & plugin->skipFlag()) != 0) continue;diff --git a/src/esengine/renderer/plugins/MeshPlugin.cpp b/src/esengine/renderer/plugins/MeshPlugin.cppindex 7040de67f..a47369f2d 100644--- a/src/esengine/renderer/plugins/MeshPlugin.cpp+++ b/src/esengine/renderer/plugins/MeshPlugin.cpp@@ -231,7 +231,7 @@ void MeshPlugin::collect(RenderCollectContext& collect_ctx) {.normalTextureId = normalTextureId,.shadowTextureId = ctx.shadow_texture_id,.envTextureId = ctx.environment_texture_id,- .depth = position.z,+ .depth = collect_ctx.camera.viewDepth(position),.y = position.y,.entity = entity,.type = RenderType::Mesh,diff --git a/src/esengine/renderer/plugins/ParticlePlugin.cpp b/src/esengine/renderer/plugins/ParticlePlugin.cppindex eab08a2e9..475358354 100644--- a/src/esengine/renderer/plugins/ParticlePlugin.cpp+++ b/src/esengine/renderer/plugins/ParticlePlugin.cpp@@ -156,7 +156,7 @@ void ParticlePlugin::collect(RenderCollectContext& collect_ctx) {.shaderId = particle_shader_id_,.blend = blendMode,.textureId = textureId,- .depth = emitterWorldPos.z,+ .depth = collect_ctx.camera.viewDepth(emitterWorldPos),// Sorted by world Y like every other draw — a burst left at y = 0// loses to any sprite standing anywhere else, so an emitter placed on// a character disappears behind them.@@ -182,7 +182,7 @@ void ParticlePlugin::collect(RenderCollectContext& collect_ctx) {.shaderId = ctx.batch_shader_id,.blend = blendMode,.textureId = ctx.white_texture_id,- .depth = emitterWorldPos.z,+ .depth = collect_ctx.camera.viewDepth(emitterWorldPos),.y = emitterWorldPos.y,.entity = entity,.type = RenderType::Trail,diff --git a/src/esengine/renderer/plugins/ShapePlugin.cpp b/src/esengine/renderer/plugins/ShapePlugin.cppindex 48cf36e2f..81e3a3504 100644--- a/src/esengine/renderer/plugins/ShapePlugin.cpp+++ b/src/esengine/renderer/plugins/ShapePlugin.cpp@@ -109,7 +109,7 @@ void ShapePlugin::collect(RenderCollectContext& collect_ctx) {.layer = shape.layer,.shaderId = shape_shader_id_,.blend = BlendMode::Normal,- .depth = position.z,+ .depth = collect_ctx.camera.viewDepth(position),.y = position.y,.entity = entity,.type = RenderType::Shape,diff --git a/src/esengine/renderer/plugins/SpritePlugin.cpp b/src/esengine/renderer/plugins/SpritePlugin.cppindex 3fc348bf9..d746b843e 100644--- a/src/esengine/renderer/plugins/SpritePlugin.cpp+++ b/src/esengine/renderer/plugins/SpritePlugin.cpp@@ -85,7 +85,7 @@ void SpritePlugin::collect(RenderCollectContext& collect_ctx) {.shaderId = batch_shader_id_,.blend = BlendMode::Normal,.textureId = textureId,- .depth = position.z,+ .depth = collect_ctx.camera.viewDepth(position),.y = position.y,.entity = entity,.type = RenderType::Sprite,diff --git a/src/esengine/renderer/plugins/TextPlugin.cpp b/src/esengine/renderer/plugins/TextPlugin.cppindex 0316128cc..016ad1225 100644--- a/src/esengine/renderer/plugins/TextPlugin.cpp+++ b/src/esengine/renderer/plugins/TextPlugin.cpp@@ -184,7 +184,7 @@ void TextPlugin::collect(RenderCollectContext& collect_ctx) {.shaderId = batch_shader_id_,.blend = BlendMode::Normal,.textureId = tex->getId(),- .depth = position.z,+ .depth = collect_ctx.camera.viewDepth(position),.y = position.y,.entity = entity,.type = RenderType::Text,diff --git a/src/esengine/renderer/plugins/TilemapRenderPlugin.cpp b/src/esengine/renderer/plugins/TilemapRenderPlugin.cppindex 78c678deb..30bd0d30d 100644--- a/src/esengine/renderer/plugins/TilemapRenderPlugin.cpp+++ b/src/esengine/renderer/plugins/TilemapRenderPlugin.cpp@@ -157,7 +157,7 @@ void TilemapRenderPlugin::collect(RenderCollectContext& collect_ctx) {const auto& layers = tilemap_system_->allLayers();if (layers.empty()) return;- const CameraWorldRect& cam = collect_ctx.camera;+ const CameraView& cam = collect_ctx.camera;for (const auto& [entity, layer] : layers) {// The TilemapLayer component is the single source of a layer's visual@@ -366,6 +366,9 @@ void TilemapRenderPlugin::collect(RenderCollectContext& collect_ctx) {.shaderId = batch_shader_id_,.blend = BlendMode::Normal,.textureId = resolved[si].glTexId,+ // Authored, not measured: a tilemap layer is flat content stacked+ // by a number the layer carries, so there is no world point to ask+ // the camera how near it is. It stays a plain sort value..depth = depth,.entity = entity,.type = RenderType::Sprite,diff --git a/src/esengine/renderer/plugins/TrailPlugin.cpp b/src/esengine/renderer/plugins/TrailPlugin.cppindex e49a19a1c..590ed99a6 100644--- a/src/esengine/renderer/plugins/TrailPlugin.cpp+++ b/src/esengine/renderer/plugins/TrailPlugin.cpp@@ -92,7 +92,7 @@ void TrailPlugin::collect(RenderCollectContext& collect_ctx) {.shaderId = ctx.batch_shader_id,.blend = static_cast<BlendMode>(trail.blendMode),.textureId = textureId,- .depth = headWorld.z,+ .depth = collect_ctx.camera.viewDepth(headWorld),.y = headWorld.y,.entity = entity,.type = RenderType::Trail,diff --git a/src/esengine/renderer/plugins/UIElementPlugin.cpp b/src/esengine/renderer/plugins/UIElementPlugin.cppindex 53bc7fb2b..694e2adb5 100644--- a/src/esengine/renderer/plugins/UIElementPlugin.cpp+++ b/src/esengine/renderer/plugins/UIElementPlugin.cpp@@ -223,7 +223,7 @@ void UIElementPlugin::collect(RenderCollectContext& collect_ctx) {.shaderId = batch_shader_id_,.blend = BlendMode::Normal,.textureId = textureId,- .depth = position.z,+ .depth = collect_ctx.camera.viewDepth(position),.cullBit = renderer.uiCullBit,.entity = entity,.type = RenderType::UIElement,diff --git a/tools/renderScenes.mjs b/tools/renderScenes.mjsindex c64397907..fe7d5480d 100644--- a/tools/renderScenes.mjs+++ b/tools/renderScenes.mjs@@ -251,6 +251,10 @@ export const SCENES = [// centres at x = ±120 project to 0.40 / 0.60, with 0.30 empty. The hit test at// the new place proves screen→world followed the turn.{ id: "view-orbit", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_ORBIT: "60,0", ESTELLA_VERIFY_PICK: "{\"x\":0.40,\"y\":0.556,\"entity\":1}", ESTELLA_VERIFY_SCENE: "/scenes/mesh2d.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/mesh2d.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.40,\"y\":0.556,\"rgb\":[255,0,0],\"tol\":40},{\"x\":0.60,\"y\":0.556,\"rgb\":[0,255,0],\"tol\":40},{\"x\":0.30,\"y\":0.556,\"rgb\":[0,0,0],\"tol\":30}]" } },+ // Two blended quads side by side in X at the SAME world z, the far one submitted+ // last, seen from an eye turned -60° about Y. Equal world z ties, and the tie puts+ // the FAR quad on top; only a viewer-measured depth puts the near (green) one there.+ { id: "sort-view-depth", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_ORBIT: "-60,0", ESTELLA_VERIFY_SCENE: "/scenes/sort-view-depth.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/sort-view-depth.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5,\"y\":0.5,\"rgb\":[0,255,0],\"tol\":40},{\"x\":0.30,\"y\":0.5,\"rgb\":[0,255,0],\"tol\":40},{\"x\":0.70,\"y\":0.5,\"rgb\":[255,0,0],\"tol\":40}]" } },// Two quads crossing: one flat, one turned 60° about Y, so each is nearer on// one side. Painter's order cannot draw that — with `opaque` the halves resolve// by depth (left green, right red), and without it the later draw takes both.