Skip to content
C++ → WebAssembly → Browser

Run the real VTK in a browser tab.

The same C++ rendering and filtering pipeline that ships in desktop VTK, compiled to WebAssembly and drawn with WebGL/WebGPU. No server-side rendering, no pixel streaming, no rewrite.

0
GPU servers required
4
languages, one runtime
main.ts
import { loadAsync } from "@kitware/vtk-wasm";
const BUNDLE_URL = "https://raw.githack.com/Kitware/vtk-wasm/dist/latest/vtk-wasm32-emscripten.tar.gz";
const runtime = await loadAsync({ url: BUNDLE_URL });
const session = runtime.createStandaloneSession();
const vtk = session.vtk;
// Generate a mesh
const shapes = vtk.vtkPartitionedDataSetCollectionSource({ numberOfShapes: 2 });
const mapper = vtk.vtkCompositePolyDataMapper();
const actor = vtk.vtkActor({ mapper});
actor.property.edgeVisibility = true;
actor.property.edgeColor = [0.2, 0.2, 0.2];
// Add actor a vtkRenderer
const renderer = vtk.vtkRenderer({ background: [0.384314, 0.364706, 0.352941] });
renderer.addActor(actor);
renderer.resetCamera();
// Create a vtkRenderWindow and bind it to a canvas in the DOM
const renderWindow = vtk.vtkWebAssemblyOpenGLRenderWindow({ canvasSelector });
renderWindow.addRenderer(renderer);
const interactor = vtk.vtkWebAssemblyRenderWindowInteractor({ canvasSelector, renderWindow });
interactor.interactorStyle.setCurrentStyleToTrackballCamera();
// Start event loop
interactor.start();
renders an interactive scene, client-side
Four entry points

Pick the language you already write

Each path ends at the same WASM module. Start where your codebase already is.

How it works
  1. 01
    Install the package
    The same package as the JavaScript path; types ship with it.
    npm i @kitware/vtk-wasm
  2. 02
    Generate declarations
    A CLI reads the per-class manifests out of your VTK.wasm bundle.
    npx vtk-wasm gen-types --url <bundle>
  3. 03
    Include the output
    Drop the .d.ts anywhere tsconfig already picks up, such as src/.
    src/vtk-wasm.gen.d.ts
  4. 04
    Write typed VTK
    Per-class methods, properties, and class-typed arguments all check.
    vtk.vtkConeSource({ resolution: 32 })
viewer.tsgenerated .d.ts
import { loadAsync, type StandaloneSession } from "@kitware/vtk-wasm";

const runtime = await loadAsync({
  url: "https://raw.githack.com/Kitware/vtk-wasm/dist/latest/vtk-wasm32-emscripten.tar.gz",
  rendering: "webgl", // or "webgpu"
});
const session: StandaloneSession = runtime.createStandaloneSession();
const vtk = session.vtk;

const cone = vtk.vtkConeSource({ resolution: 32 });
const mapper = vtk.vtkPolyDataMapper();
mapper.setInputConnection(cone.getOutputPort());

const actor = vtk.vtkActor({ mapper });
const renderer = vtk.vtkRenderer();
renderer.addActor(actor);

const canvasSelector = session.registerCanvas("!vtk-canvas", canvas);
const interactor = vtk.vtkRenderWindowInteractor({ canvasSelector });
const window = vtk.vtkRenderWindow({ interactor, canvasSelector });
window.addRenderer(renderer);
await window.render();
interactor.start();
Live demos

Running in your browser, right now

open in full screen and inspect source in dev console
Porsche
Multi-actor CAD assembly, picking
Full screen →
Procedural terrain
351k triangles built in the browser, hit Generate
Full screen →
Dynamic mesh
Render dynamic geometry
Full screen →
Scalar bar widget
Scalar bar widget
Full screen →
Starfighter
Glyphs, scalar bar, interactive widgets
Full screen →
Volume rendering
531k voxels ray cast on the GPU, change transfer function preset
Full screen →
A thousand actors and more
Every object its own vtkActor, add more to test performance
Full screen →
Latest
August 30, 2026
9.7.20260830 is now available!
pip install "vtk==9.7.20260830.dev0" --extra-index-url https://wheels.vtk.org
August 23, 2026
9.7.20260823 is now available!
pip install "vtk==9.7.20260823.dev0" --extra-index-url https://wheels.vtk.org
Next
planned
Build VTK.wasm with shared library support
Targeted for the next release.
planned
Type hints (*.d.ts files)
Targeted for the next release.
shipped
Multiple interactor event loops running simultaneously in one WASM module
Released in 9.7.0.
shipped
Interactor style manipulators
Released in 9.7.0.
shipped
API to remove all observers that users added via vtkSession.Observe()
Released in 9.7.0.