This project demonstrates how to use the Spark library to create a "Matrix" style visual effect on a 3D Gaussian Splatting scene.
The demo loads a scene (greyscale-bedroom.spz) and dynamically applies a fractal shader using Spark's dyno system, modifying the color and position of the splats in real-time.
The core of the effect lies in a custom shader injected into the Spark rendering pipeline:
- Generative Fractal: A GLSL fractal function creates geometric patterns based on coordinates and time.
- Color Manipulation: The shader darkens the original scene and highlights specific areas with a characteristic neon green hue, modulated by the fractal value.
- Geometric Deformation: Splats are displaced along the Y-axis following a sinusoidal and noise pattern, simulating digital "rain" or distortion.
- Dyno System: Spark allows writing these shaders in JavaScript/TypeScript via its
dynoAPI, which compiles to optimized GLSL.
@sparkjsdev/spark (v0.1.10) is an advanced 3D Gaussian Splatting renderer designed to integrate seamlessly with Three.js.
- High Performance: Uses WebAssembly (Rust) for intensive splat sorting and processing operations.
- Optimized Format: Native support for
.spzfiles, an efficient compressed format for Gaussian Splats. - Dyno System: A powerful programmable shader system that allows dynamic modification of splats (position, scale, color, rotation) without re-uploading geometry to the GPU.
- Three.js Integration: Works as just another object within the Three.js scene, allowing mixing of splats with traditional meshes, lights, and cameras.
To run this project locally:
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser at
http://localhost:8080.
/splat-matrix/main.js: Main scene logic anddynoshader definition./assets/: Contains locally downloaded model and splat files (.spz)./src/: Source code of the Spark library.