Find and fix what makes a three.js scene slow or broken.
Eight small packages that measure, inspect, check, stage, batch and adapt three.js scenes. Use one, or all.
- no third-party deps
- vanilla three + R3F
- typed
- MIT
import {
PerformanceMonitor, wrapAnimationLoop,
} from "@zkmake/three-meter";
import { mountPerfHud }
from "@zkmake/three-meter/ui";
const monitor =
new PerformanceMonitor({ renderer });
mountPerfHud(monitor);
renderer.setAnimationLoop(
wrapAnimationLoop(monitor, render),
);import { PerfHud, PerfSampler }
from "@zkmake/three-meter/react";
<>
<Canvas>
<PerfSampler />
{/* scene */}
</Canvas>
<PerfHud />
</>;import { mountTexturePanel }
from "@zkmake/three-textures/ui";
const panel =
mountTexturePanel({ scene, renderer });
// later: panel.dispose()import { TexturePanel }
from "@zkmake/three-textures/react";
<Canvas>
{import.meta.env.DEV && <TexturePanel />}
{/* … */}
</Canvas>;import { mountCameraPanel }
from "@zkmake/three-cameras/ui";
const panel =
mountCameraPanel({ scene, renderer });
// later: panel.dispose()import { CameraPanel }
from "@zkmake/three-cameras/react";
<Canvas>
<CameraPanel />
{/* … */}
</Canvas>;import { findBadGeometry, findZFighting }
from "@zkmake/three-audit";
test("no z-fighting or NaNs", () => {
expect(findZFighting(mill)).toEqual([]);
expect(findBadGeometry(mill)).toEqual([]);
});// No React parts: it runs in tests and CI.
import { findBadGeometry, findZFighting }
from "@zkmake/three-audit";
test("no z-fighting or NaNs", () => {
expect(findZFighting(mill)).toEqual([]);
expect(findBadGeometry(mill)).toEqual([]);
});import { resolveStudio }
from "@zkmake/three-studio";
import { mountStudio }
from "@zkmake/three-studio/ui";
const state =
resolveStudio(config, location.search);
const studio = mountStudio({
state, renderer, scene, camera,
});
// after each render: studio.update()import { Studio }
from "@zkmake/three-studio/react";
<Studio
config={{ views, areas: {
trees: { variants: TREES },
} }}
stage={() => <GameLights />}
/>;import { bake, chunkInstances }
from "@zkmake/three-batch";
// dozens of meshes, one draw per material
const undo = bake(station);
// culling cells for a world-wide field
scene.add(
chunkInstances(grass, { size: 128 }),
);import { Baked }
from "@zkmake/three-batch/react";
// dozens of meshes, one draw per material
<Baked name="station">
<mesh geometry={wall} material={brick} />
<mesh geometry={roof} material={slate} />
</Baked>;import { adaptQuality }
from "@zkmake/three-quality";
// pixel ratio, then shadows, until
// the frame rate holds
const quality = adaptQuality(renderer, {
tiers: [{ name: "shadows", set }],
});import { AdaptiveQuality }
from "@zkmake/three-quality/react";
<Canvas dpr={1}>
<AdaptiveQuality tiers={["shadows"]} />
{/* … */}
</Canvas>;import { mountDevTools }
from "@zkmake/three-devtools";
// ?debug: HUD, console helpers, panels
const tools = mountDevTools({
renderer, scene, budgets,
});
renderer.setAnimationLoop(
tools.wrap(render),
);import { DevTools }
from "@zkmake/three-devtools/react";
<Canvas>
{/* scene */}
<DevTools budgets={budgets} />
</Canvas>;
three-meter, measuring this page: 4,096 cubes in 1 draw callhover to make ripples
Eight packages, one kit
Each installs on its own; the five dev tools as dev dependencies.
See what every frame costs
FPS, CPU and GPU time, stutter, draw calls and triangles, live in a HUD you dock anywhere. Budgets flag what's over. WebGL and WebGPU.
Edit textures in the running scene
Download any texture the scene draws with, paint over it, drop it back in and see it lit, with no rebuild. A/B against the original, live-link a file. KTX2 too.
See every camera, and which are drawing
Lists the scene's cameras and the one the renderer draws with, marks the live ones, edits them live, and animates them on a keyframe timeline with motion paths.
Catch broken geometry before it ships
Find z-fighting, parts through or off each other, NaN normals, shadow and colour setups that draw wrong, black frames, and triangle, draw-call or texture-memory blowups. Assert on them in unit tests with Vitest matchers, run them in the console, or check glTF files in CI, all against one budgets file per app.
Look at one part at a time
A mockups or model-studio page from a config: areas, variants and camera views in the URL, orbit controls, a draw-call readout, and shots saved to disk and diffed.
Draw less, render faster
Cut draw calls and triangles: culling cells for world-spanning meshes, static bakes, batches that follow moving objects, instance pools, far copies.
Hold the frame rate on any device
Steps the pixel ratio down when frames run slow and back up when there's room, then your own tiers (shadows, bloom). Checks each step paid, remembers the device. WebGL and WebGPU.
Every dev tool behind ?debug
One call or component mounts the HUD with the app's budgets and adaptive quality, the console helpers, and the panels it asks for. All lazy: a normal load pays nothing.
Agent skills, built on the kit
Ways of working on a scene, for a coding agent: measured with the packages, shown with screenshots. For any agent, or as a Claude Code plugin.
all about the skills →npx skills add zkmake/three-kit/plugin marketplace add zkmake/three-kit/plugin install three-kit@three-kitMove one three.js / React Three Fiber app onto the three-kit packages in one pass. Surveys what it carries by hand (debug and perf-meter copies, a studio or mockups shell, hard-coded budgets and pixel ratio, triangle-count test helpers), swaps each for its package (a defineBudgets file with toFitBudget tests, one DevTools drop-in behind ?debug, a three-studio page, three-quality), removes what's dead, verifies nothing changed on screen, and reports lines removed and what the app gained. Use when the user asks to adopt the kit, move an app onto three-kit, or replace an app's copied debug, studio or budget code.
loop- survey
- baseline
- budgets
- dev tools
- studio
- quality
- prune
- verify
- report
Remodel one three.js / React Three Fiber object at a time for silhouette, topology, triangle budget and z-fighting, measured in a model studio and verified with screenshots against the project's 3D style guide. Use when the user asks for a model pass on an object, or to remodel, clean up or cut the triangles of one model.
loop- baseline
- remodel
- audit
- distance
- verify
Fit a whole three.js / React Three Fiber frame to the project's budgets, one area at a time. Surveys draws and triangles at every play position, ranks areas by what the frame really draws, and takes the costliest through the cheapest fix that keeps the look, verified by pixel diff. Use when the user asks for a perf pass, or to fit a scene's frame to its triangle or draw-call budget.
loop- survey
- rank
- pass
- write back
Mock up more detail for one part of a three.js / React Three Fiber scene (props, scenery, characters, vehicles, backdrops) as variants built in the app itself, run a model pass on what's there, and publish a page to pick from; then build the picks into the app. Use when the user asks for mockups, variants or a richer look for part of a scene to choose from.
loop- scope
- study
- kit
- mockups
- capture
- pass
- picks page