Terrain from geology
Tectonic uplift, drainage and GPU erosion shape seven landforms, from alpine ranges to fjords. Or load real elevation from GeoTIFF files, raw heightmaps and images.
Version 2.0 · Rust, WebAssembly and WebGPU
Give VistaWASM a canvas and it builds a world: mountains carved by erosion, forests that sway in the wind, rivers, oceans, clouds and weather. One npm package, a typed API, and nothing else to download.
npm install @vista-wasm/vista-wasm
Free and open source. Runs in browsers with WebGPU, such as current Chrome and Edge.
What you get
Every system is on by default and looks right out of the box. Each one can be tuned, switched off, or replaced with your own.
Tectonic uplift, drainage and GPU erosion shape seven landforms, from alpine ranges to fjords. Or load real elevation from GeoTIFF files, raw heightmaps and images.
Nineteen biomes place eight grown tree species by climate, slope and water, with grass, rock and scree. Trees sway in layered wind and cast shadows.
An ocean to the horizon with simulated waves and surf, and rivers, lakes and waterfalls routed from rain and snowmelt, carved into the land.
A physically based sky, volumetric clouds from fair cumulus to storms, cirrus and mid-level layers, time of day, rain, snow, fog and lightning.
Paint height, biomes, water and vegetation, import them as images, and export fifteen maps, every tree and a round-trip bundle.
An async loader, validated options with clear errors, events, and TypeScript declarations for everything. Written in Rust, drawn with WebGPU.
Rendered in the browser
Every picture below comes straight from VistaWASM running in a browser tab. Try it yourself: the demo generates a new world from any seed.
Quick start
Install the package, give it a canvas, and generate. The package ships pre-built, so you need no Rust and no build tools.
import { attachFlyCameraControls, createVistaEngine } from "@vista-wasm/vista-wasm";
const canvas = document.querySelector("canvas")!;
const engine = await createVistaEngine(canvas, {
render: {
width: canvas.clientWidth,
height: canvas.clientHeight,
devicePixelRatio: window.devicePixelRatio
}
});
await engine.generateFractal({
seed: 12345,
size: 1024,
horizontalScaleMetres: 12,
verticalScale: 1,
landform: "continental",
noise: { kind: "ridged", octaves: 7, gain: 0.5, lacunarity: 2 }
});
// Fly with the mouse and WASD, then make it rain.
attachFlyCameraControls(engine, canvas, {
initialPosition: [0, 420, 1400],
initialYawDegrees: 180,
initialPitchDegrees: -14
});
engine.setWeather({ enabled: true, state: "rain" });
engine.start();
Fits your stack
Draw your characters and effects over a VistaWASM world, or take its terrain into the scene you already have.
three.js objects over the landscape with one shared camera, or VistaWASM terrain as a three.js mesh.
Babylon.js meshes over the landscape, with hills that hide them, or the terrain in your Babylon.js scene.
Complete components that create, resize and dispose of the engine the right way.
Every function, method, event and error code on one page, with links to each option's range.
VistaWASM is built in the open. A star takes one click, helps other developers find the project, and tells us to keep going.
Questions
Any browser with WebGPU in a secure context (HTTPS, or localhost while developing), such as current Chrome and Edge. There is no WebGL fallback.
Call detectVistaWasmSupport() first to show your own fallback, or export the terrain and draw it with three.js or Babylon.js on WebGL.
No. The npm package ships the compiled WebAssembly, its JavaScript glue and TypeScript declarations. Serve .wasm files as application/wasm and you are done.
A minimal app is about 570 KB gzipped, or 460 KB with Brotli, the WebAssembly included. That one download draws everything: textures and trees are generated on the GPU at start-up, so there are no assets to fetch.
Yes. Replace any tree species' model, any texture layer, or procedural placement with your own trees. Paint biomes, water and vegetation density, or import them as images.
VistaWASM is free and open source under the GNU AGPL, version 3. If you distribute an application that includes it, or offer one to people over a network, you must make that application's complete source code available to them under the same licence.