Skip to content

R3F

This page covers the optional threejs-debug-view/r3f adapter only.

The native runtime is the main path — see Native Runtime. Install steps for both paths live in Quick Start.

import { DebugViewLayer } from "threejs-debug-view/r3f"
function DebugLayer() {
if (!import.meta.env.DEV) return null
return <DebugViewLayer />
}

Mount DebugLayer inside your <Canvas>. You do not need a separate <Leva /> import — the panel mounts on document.body by default.

IncludedWhat you get
Built-in viewsBeauty, normals, depth, material channels, wireframe, lighting-only, reflection-only, measured overlap, light overlap, and shader cost
Leva controlsView picker, layouts, pane assignments, labels, blend opacity, diagonal angle
RuntimeSame WebGPU MRT passes and TSL compositor as the native export
DOM labels & legendsViewport labels and diagnostic legends

When the panel should live in a specific place in your app shell:

import { DebugViewLayer, DebugViewLeva } from "threejs-debug-view/r3f"
<>
<Canvas>
<Scene />
<DebugViewLayer showLeva={false} />
</Canvas>
<DebugViewLeva />
</>

When your app owns UI state, use DebugViews with useDebugViewsControls instead of DebugViewLayer. See Quick Start — bring your own controls.

Useful props:

  • showEnabledControl={false} — keep debug views always mounted (demo default)
  • custom views / viewLabels — subset of diagnostics
  • viewportViews, layout, paneCount — fixed pane assignments
Published on npmRepo only (not in tarball)
dist/ ESM + typesDemo app (src/)
LICENSE, README.md, logoDocs site and hosted demo build
GoalUse
Native WebGPU looproot threejs-debug-viewNative Runtime
Fastest R3F integrationDebugViewLayer
Custom R3F UIDebugViews + useDebugViewsControls
Try layouts interactivelyLive demo

The hosted demo exercises scene tabs, layout presets, shader-cost click-to-sample, and overlap legends. It validates the product surface; it is not installed from npm.