# VLAM!

<!-- Image shields. Do not flatten CI badges to text links. -->

[![CI](https://github.com/Voluma-ai/vlam/actions/workflows/ci.yml/badge.svg)](https://github.com/Voluma-ai/vlam/actions/workflows/ci.yml)
[![npm](https://img.shields.io/npm/v/@voluma/vlam.svg)](https://www.npmjs.com/package/@voluma/vlam)
[![demo](https://img.shields.io/badge/demo-live-4c1.svg)](https://vlam.voluma.ai)
[![license](https://img.shields.io/github/license/Voluma-ai/vlam.svg)](./LICENSE)

A WebGPU Gaussian Splat viewer for three.js, extensible with TSL shader modifiers.

**Docs and demo:** [https://vlam.voluma.ai](https://vlam.voluma.ai) · [get started](site/get-started.md) · [guides](docs/guide/README.md)

Local site and generated API: `npm run dev` [http://localhost:5170](http://localhost:5170)

## Install

```bash
npm install @voluma/vlam three
```

`three` is a peer dependency (`>= 0.186.0`).

## Usage

```ts
import * as THREE from 'three/webgpu';
import { SplatMesh } from '@voluma/vlam';
import { loadSplatData } from '@voluma/vlam/loaders';

const renderer = new THREE.WebGPURenderer({ antialias: true });
renderer.setSize(innerWidth, innerHeight);
document.body.appendChild(renderer.domElement);

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(60, innerWidth / innerHeight, 0.01, 100);
camera.position.set(1, 0.5, 1.4);
camera.lookAt(0, 0, 0);

const splats = new SplatMesh(await loadSplatData('/scene.sog'));
scene.add(splats);

renderer.setAnimationLoop(() => {
 splats.update(camera, renderer);
 renderer.render(scene, camera);
});
```

`SplatMesh` works with a regular three.js `WebGPURenderer` (including its
automatic WebGL2 fallback). For large streamed or unified scenes,
`createWebGPURenderer()` is an optional convenience that requests higher WebGPU
device limits and preserves MSAA where supported.


Supported formats: `.sog`, `.ply`, `.spz`, `.splat`, `.ksplat`, `.lcc`, `.lcc2`, `.rad`.
Animated splats, meaning captured 4D Gaussian splat (4DGS) clips and splats rigged to a
`THREE.Skeleton`, play through a standard three.js `AnimationMixer`, the same way a glTF
animation does (`@voluma/vlam/dynamic`, experimental). The 4D formats supported today are
Animated SOG `.asog` and Faltwerk `.csgs`; see the [dynamic splats guide](docs/guide/dynamic-splats.md).
Optional proxy-mesh relighting is available from `@voluma/vlam/relighting`;
see the [relighting guide](docs/guide/relighting.md). Support and remaining
device-validation gates are tracked separately in the
[capability matrix](docs/capabilities.md) and [roadmap](ROADMAP.md).


## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) and [docs/architecture.md](docs/architecture.md). By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md). Security reports: see [SECURITY.md](SECURITY.md).

## License

[MIT](LICENSE). Third-party notices: [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).

Made by [Voluma](https://voluma.ai).
