This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Rust-based WebAssembly Gaussian Splatting viewer that renders 3D scenes in the browser using WebGL2. The project combines Rust's performance with web technologies to create an interactive 3D viewer.
- Dual Build Targets: The project compiles to both WASM (for web) and native binary (for local processing)
- Web Binary (
src/web.rs): Main entry point for WASM compilation, handles WebGL rendering and browser interactions - Local Binary (
src/local/local.rs): Native binary for processing PLY files and data conversion - Core Modules:
splat.rs- Gaussian splat data structures and rendering logicoct_tree.rs- Spatial data structure for efficient splat managementrenderer.rs- WebGL2 rendering pipeline (WASM only)camera.rs- Camera controls and transformations (WASM only)loader.rs- File loading and parsing utilitiesply_splat.rs- PLY file format handlingscene.rs- Scene management and object composition
- Serialization: Uses
rkyvfor fast binary serialization of splat data - Rendering: WebGL2 with custom shaders for Gaussian splat rendering
- Parallelization: Uses
rayonandwasm-bindgen-rayonfor multi-threading - UI:
eguifor web-based GUI components - File Formats: Supports PLY files and custom
.rkyvserialized format
./build.shThis runs wasm-pack build --target web and removes the generated .gitignore file.
./buildLocal.shThis builds and runs the local binary for PLY file processing.
cargo test- Use
./build.shto compile for web deployment - Serve
index.htmlwith a local web server (e.g., VS Code Live Server) - Use
./buildLocal.shto process PLY files into the optimized.rkyvformat - Edit
src/local/local.rsto configure local processing tasks
- Raw 3D scans are stored as PLY files in the
splats/directory - Use the local binary (
cargo run --release --bin local -- <file.rkyv|file.ply> ...) to convert PLY/rkyv files to the compact packed.gszformat - The web application loads
.gszfiles (legacy.rkyvURLs still work — the loader auto-detects the format by magic bytes) - Converted files live in
splats/v2/, mirrorings3://zimpmodels/splats/v2/, which serves them gzipped (Content-Encoding: gzip) - Splats are organized in an octree for efficient spatial queries and rendering
- Release builds use
opt-level = 3+ thin LTO (wasm-optstays disabled for atomics/shared-memory compatibility);./build.shbuilds with--release - The packed
GSZ1format is ~26 bytes/splat: f32 positions, f16 scales, u8 quaternions, u8 RGBA; cov3d is recomputed at load time - Uses counting sort for efficient splat depth sorting
- Implements instance rendering for splats using WebGL2 data textures