TechniquesNewAutomatic instancing
Every plain opaque mesh in a scene is drawn through shared InstancedMeshes, one per geometry, material and shadow flags, with no change to the code that builds the scene.

The HaTac engine’s model import, lifted whole and engine-free, with a standalone WebGPU stage to draw it.
A self-contained glTF 2.0 binary is checked before anything is allocated (file, JSON and decoded byte budgets, triangle, vertex, node, joint and image limits, no external URIs, opaque materials only, meshopt and quantized data decoded in plain TypeScript), packed into one compact vertex layout, fitted to a height, length or largest size with its feet on the ground, given three simplified index ranges per primitive by the engine’s own quadric simplifier, and its embedded PNG or JPEG maps read into three texture arrays. Skins (four influences), node animation (linear, step and cubic-spline clips) and recorded transform tracks are evaluated at absolute show time, so playing and scrubbing give the same vertices; a batch of placed copies shares one pose, and copies on different clocks are different batches. The stage, written for the library, picks each copy’s level by projected size on the engine’s curve with its rate limit and dithered cross-fade, culls by the view, draws one fixed shadow map, a contact shadow under each footprint and the engine’s material code, and exports its light model’s WGSL so a page’s own ground and sky light the same way. A camera can ride any node. The demo is a crowd of one generated GLB, a jointed wooden toy dancer, in a round square: a leader and six rings, each ring a batch a little behind the one inside, so every move ripples outward.
Measured 28 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 158, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 1.50–1.53, CPU 1.13–1.23 ms). What ran: Alone: one batch of four copies of the generated dancer (6,820 source triangles, 3,700 vertices, 12 joints) pinned to levels 0–3, posed on the CPU each frame from the show programme, drawn with its shadow map, ground contact and the square’s ground and sky, at golden hour. Phones: tiers are being measured next.
Frames run on a 60 Hz timer (a page demo), so most frames take about one tick, 16.7 ms: the spread around it is what matters.
install("glb-stage")Your coding agent reads its pitfalls and installs it through the library’s MCP server. Set it upFrom HaTac. Adapted from published work, named below.
Hannes Andersson: The HaTac engine’s model import, mesh simplifier, structure drawer and their tests (built for his game and proven there); the library’s stage, demo and generated models.
The Khronos Group, glTF 2.0: The binary container, accessors, skins, animation samplers and materials the reader follows, and the meshopt compression extensions its decoder is written from.
Arseny Kapoulkine, meshoptimizer (MIT): The compression format the plain-TypeScript decoder reads (its licence travels in module/model/meshoptimizer-LICENSE.md).
Michael Garland & Paul S. Heckbert, Surface simplification using quadric error metrics (SIGGRAPH 1997): The error quadrics mesh-lod’s edge collapses rank by.
Brian Karis, Real shading in Unreal Engine 4 (SIGGRAPH 2013): The GGX distribution, Schlick–Smith visibility and Fresnel in the stage’s light model.
Krzysztof Narkowicz, ACES filmic tone mapping curve (2016): The fitted curve the stage tone-maps with.