Skip to content

kali-shade/splat-matrix

Repository files navigation

Spark - Matrix Effect with 3D Gaussian Splatting

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.

How the Effect Works

The core of the effect lies in a custom shader injected into the Spark rendering pipeline:

  1. Generative Fractal: A GLSL fractal function creates geometric patterns based on coordinates and time.
  2. Color Manipulation: The shader darkens the original scene and highlights specific areas with a characteristic neon green hue, modulated by the fractal value.
  3. Geometric Deformation: Splats are displaced along the Y-axis following a sinusoidal and noise pattern, simulating digital "rain" or distortion.
  4. Dyno System: Spark allows writing these shaders in JavaScript/TypeScript via its dyno API, which compiles to optimized GLSL.

About the Spark Library

@sparkjsdev/spark (v0.1.10) is an advanced 3D Gaussian Splatting renderer designed to integrate seamlessly with Three.js.

Key Features:

  • High Performance: Uses WebAssembly (Rust) for intensive splat sorting and processing operations.
  • Optimized Format: Native support for .spz files, 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.

Installation and Usage

To run this project locally:

  1. Install dependencies:

    npm install
  2. Start the development server:

    npm run dev
  3. Open your browser at http://localhost:8080.

Project Structure

  • /splat-matrix/main.js: Main scene logic and dyno shader definition.
  • /assets/: Contains locally downloaded model and splat files (.spz).
  • /src/: Source code of the Spark library.

About

Splat Matrix effect using spark.js

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages