# antimatter15/splat architecture

> Architecture diagram of the GitHub repository antimatter15/splat, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/antimatter15/splat
- Repository: https://github.com/antimatter15/splat

## Overview

splat is a browser-based WebGL viewer for navigable 3D Gaussian-splat scenes, with a Python PLY-to-SPLAT converter. The main workflow loads a SPLAT file, progressively prepares and sorts splats, then renders them while user input changes the camera. The README also documents camera presets, URL view state, and file drop support. Most viewer responsibilities are implemented in one file; unsampled details are represented only where documented, and the excerpt does not show every event or worker message.

Main entry points: [`main.js`](https://github.com/antimatter15/splat/blob/main/main.js) (Camera controls), [`convert.py`](https://github.com/antimatter15/splat/blob/main/convert.py) (PLY converter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Scene Input"]
  node_load["Load scene<br/>[main.js]"]
  node_drop["File drop input<br/>[main.js]"]
  node_cameraimport["Camera import<br/>[main.js]"]
end

subgraph group_viewer["Viewer Runtime"]
  node_camera["Camera controls<br/>[main.js]"]
  node_presets["Camera presets<br/>[main.js]"]
  node_viewurl["View URL state<br/>[main.js]"]
  node_sort["Depth sorting<br/>[main.js]"]
  node_worker["Sort worker<br/>[main.js]"]
end

subgraph group_render["Rendering"]
  node_prepare["Splat preparation<br/>[main.js]"]
  node_shaders["WebGL shaders<br/>[main.js]"]
  node_draw["Scene rendering<br/>[main.js]"]
end

subgraph group_convert["Conversion"]
  node_converter["PLY converter<br/>[convert.py]"]
end

node_person(("Viewer user"))
node_host[("SPLAT host")]
node_ply["PLY input"]

node_person -->|"opens scene"| node_load
node_load -->|"fetches SPLAT"| node_host
node_load -->|"reads stream"| node_prepare
node_prepare -->|"prepares splats"| node_sort
node_sort -->|"sorts asynchronously"| node_worker
node_camera -.->|"updates depth order"| node_sort
node_camera -->|"changes viewpoint"| node_draw
node_presets -->|"sets viewpoint"| node_camera
node_viewurl -->|"restores view"| node_camera
node_prepare -->|"supplies splats"| node_draw
node_draw -->|"renders with"| node_shaders
node_person -->|"controls view"| node_camera
node_person -->|"drops PLY file"| node_drop
node_person -->|"drops cameras"| node_cameraimport
node_person -->|"runs conversion"| node_converter
node_ply -->|"converts input"| node_converter

click node_load "https://github.com/antimatter15/splat/blob/main/main.js"
click node_camera "https://github.com/antimatter15/splat/blob/main/main.js"
click node_presets "https://github.com/antimatter15/splat/blob/main/main.js"
click node_viewurl "https://github.com/antimatter15/splat/blob/main/main.js"
click node_sort "https://github.com/antimatter15/splat/blob/main/main.js"
click node_worker "https://github.com/antimatter15/splat/blob/main/main.js"
click node_prepare "https://github.com/antimatter15/splat/blob/main/main.js"
click node_shaders "https://github.com/antimatter15/splat/blob/main/main.js"
click node_draw "https://github.com/antimatter15/splat/blob/main/main.js"
click node_drop "https://github.com/antimatter15/splat/blob/main/main.js"
click node_cameraimport "https://github.com/antimatter15/splat/blob/main/main.js"
click node_converter "https://github.com/antimatter15/splat/blob/main/convert.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_load,node_drop,node_cameraimport,node_person toneBlue
class node_camera,node_presets,node_viewurl,node_sort,node_worker,node_host toneAmber
class node_prepare,node_shaders,node_draw toneMint
class node_converter toneRose
class node_ply toneIndigo
```

## Components

### Scene Input

- [Load scene](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`
- [File drop input](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`
- [Camera import](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`

### Viewer Runtime

- [Camera controls](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`
- [Camera presets](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`
- [View URL state](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`
- [Depth sorting](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`
- [Sort worker](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`

### Rendering

- [Splat preparation](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`
- [WebGL shaders](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`
- [Scene rendering](https://github.com/antimatter15/splat/blob/main/main.js): `main.js`

### Conversion

- [PLY converter](https://github.com/antimatter15/splat/blob/main/convert.py): `convert.py`

### Other components

- **Viewer user**
- **SPLAT host**
- **PLY input**

## Connections

- Viewer user → Load scene: opens scene (evidence: `README.md`)
- Load scene → SPLAT host: fetches SPLAT (evidence: `main.js`)
- Load scene → Splat preparation: reads stream (evidence: `main.js`)
- Splat preparation → Depth sorting: prepares splats (evidence: `main.js`)
- Depth sorting → Sort worker: sorts asynchronously (evidence: `README.md`)
- Camera controls → Depth sorting: updates depth order (evidence: `main.js`)
- Camera controls → Scene rendering: changes viewpoint (evidence: `README.md`)
- Camera presets → Camera controls: sets viewpoint (evidence: `README.md`)
- View URL state → Camera controls: restores view (evidence: `README.md`)
- Splat preparation → Scene rendering: supplies splats (evidence: `README.md`)
- Scene rendering → WebGL shaders: renders with (evidence: `README.md`)
- Viewer user → Camera controls: controls view (evidence: `README.md`)
- Viewer user → File drop input: drops PLY file (evidence: `README.md`)
- Viewer user → Camera import: drops cameras (evidence: `README.md`)
- Viewer user → PLY converter: runs conversion (evidence: `convert.py`)
- PLY input → PLY converter: converts input (evidence: `convert.py`)
