3D engine that AI agents drive
Measure the mesh blend frame cost without the GL error watcher (#478)
Nguyen Xuan Anef1ca779b036
diff --git a/bench/reference/mesh-blend-harness.js b/bench/reference/mesh-blend-harness.jsindex cac451bf..197fd58c 100644--- a/bench/reference/mesh-blend-harness.js+++ b/bench/reference/mesh-blend-harness.js@@ -70,7 +70,7 @@ window.setupScene = async ({ scene, mode }) => {const { installMeshBlend } = await import(/* @vite-ignore */ ['/src/mesh', 'blend.js'].join('-'));installMeshBlend(renderer);}- watch(renderer.context);+ if (location.search.includes('debug')) watch(renderer.context);renderer.resize();frame ={ ...built.camera, environment: { lightDirection: [-3, 6, 4] }, time: 0, exposure: 1, effects: { ambientOcclusion: 0 } };renderer.render(frame);diff --git a/docs/mesh-blend.md b/docs/mesh-blend.mdindex 9d844383..a798a315 100644--- a/docs/mesh-blend.md+++ b/docs/mesh-blend.md@@ -14,7 +14,7 @@ For each pixel of a blend part, the pass looks at 24 taps on a spiral within `ra## Cost and limits-- No second draw of the geometry: the cost is the extra RGBA8 attachment (multisample, resolved) and one fullscreen pass that returns at once for every pixel outside a blend part. Measured with the earlier two-draw version on an RTX 3060 at 1080p (4x MSAA, a terrain with five sunk rocks and a trunk): 2.46 ms without blend, 3.42 ms with it. After the second draw was removed, a clean run was not possible because other jobs held the GPU at 100 percent (frames took 380 to 625 ms even with no addon); in that window the frame with the pass was 1.07 to 1.12 times the frame without it, against 1.39 times for the two-draw version. Run `node bench/reference/mesh-blend.mjs --only-cost` on a quiet GPU for the millisecond cost.+- No second draw of the geometry: the cost is the extra RGBA8 attachment (multisample, resolved) and one fullscreen pass that returns at once for every pixel outside a blend part. Measured on an RTX 3060 at 1080p (4x MSAA, a terrain with five sunk rocks and a trunk, median of 6 rounds of 150 frames): 2.19 ms with the addon installed and no blend part (2.24 ms with no addon), 2.92 ms with blend, so about 0.74 ms. The first version drew the object IDs in a second pass and cost 0.97 ms. What is left is the extra multisampled attachment, its resolve, the fullscreen pass and the unculled blend batches. `node bench/reference/mesh-blend.mjs --only-cost` repeats it.- Needs a renderer with `depth: true`; the render passes addon is not needed. The MCP preview has depth.- Opaque and cutout parts only. A blended part writes no ID, and translucent water or glass drawn over a blend part leaves that pixel unblended or with a stale ID (the liquid programs do not write the attachment).- A blend part mixes toward the part on the other side of its seam; the other part changes only if it has `blend` too. Marking both gives the soft seam from both sides.