How to Set Up the ArthurBrussee/brush Development Environment

Setting up the ArthurBrussee/brush development environment requires Rust ≥1.88, Node.js ≥18 for web builds, and the Android NDK for mobile targets, followed by platform-specific cargo and npm commands to compile the multi-platform 3D Gaussian Splatting engine.

The brush repository is a Rust-based 3D reconstruction engine supporting WebGPU, Android, and native desktop platforms. Setting up the ArthurBrussee/brush development environment involves installing the Rust toolchain, configuring platform-specific dependencies, and optionally building the JavaScript/WebAssembly frontends located in apps/brush-js and apps/brush-app/web.

Install the Rust Toolchain (≥1.88)

Brush requires a modern Rust toolchain. Install Rust using rustup and add the rust-src component as documented in the root README.md (#L45-L49):

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup update stable
rustup component add rust-src

Clone the Repository

Clone the source code and navigate into the project directory:

git clone https://github.com/ArthurBrussee/brush.git
cd brush

Build for Native Desktop

Compile and run the native desktop application using Cargo. The README.md (#L48-L50) documents both release and debug builds:


# Optimized release build

cargo run --release

# Debug build with symbols

cargo run

Run the Test Suite

Verify your installation by running the full test suite across all workspace crates defined in the root Cargo.toml, as noted in README.md (#L45):

cargo test --all

Build the WebAssembly Bundle

The web interface requires Node.js ≥18 and the Vite build system. The repository contains two WASM-based applications: the JavaScript library (brush-js) and the egui-based viewer (brush-app).

JavaScript Library (apps/brush-js)

Install dependencies and launch the development server. According to apps/brush-js/README.md (#L12-L16):

npm install
npm run dev:lib

This builds the WASM library and starts a Vite dev server. Open the provided localhost URL in a Chromium-based browser to use the directory picker with Brush datasets or .ply files.

WASM Viewer (apps/brush-app/web)

For the egui web viewer, navigate to the specific app directory and run the npm scripts documented in apps/brush-app/web/README.md (#L5-L9):

cd apps/brush-app/web
npm install
npm run dev      # Serves at http://localhost:5173

npm run build    # Outputs static assets to dist/

Build for Android

Android builds require the Android SDK, NDK, and specific Rust targets. Set the ANDROID_NDK_HOME and ANDROID_HOME environment variables, then add the target and install cargo-ndk as described in README.md (#L60-L70):

rustup target add aarch64-linux-android
cargo install cargo-ndk

Build the native library for the Android project:

cargo ndk -t arm64-v8a -o crates/brush-app/app/src/main/jniLibs/ build
cargo ndk -t arm64-v8a -o crates/brush-app/app/src/main/jniLibs/ build --release

After building the native library, deploy the application using Gradle commands from README.md (#L71-L76):

./gradlew build
./gradlew installDebug
adb shell am start -n com.splats.app/.MainActivity

Alternatively, open the apps/brush-app folder in Android Studio and click Run. Note that Android Studio does not automatically rebuild Rust code; you must run the cargo-ndk commands above when modifying sources in crates/brush-app or dependencies.

Install Optional Visualization Tools

For live visualization during training, install the Rerun CLI tool. This optional dependency is referenced in README.md (#L45-L46):

cargo install rerun-cli

When running training commands from the brush-train crate, the Rerun viewer opens automatically if installed, utilizing the async runtime abstractions in crates/brush-async/src/lib.rs.

Code Examples

The following snippets demonstrate common entry points into the Brush APIs using the brush-train, brush-dataset, and brush-js crates.

Rust Training API

Start a training session programmatically using the Train struct from crates/brush-train/src/train.rs:

use brush_train::train::Train;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Load a COLMAP or Nerfstudio dataset
    let dataset = brush_dataset::load("path/to/dataset").await?;
    
    // Initialize default training configuration
    let config = brush_train::config::TrainConfig::default();
    
    // Run the training loop
    let mut train = Train::new(dataset, config).await?;
    for _ in 0..5 {
        train.step().await?;
    }
    Ok(())
}

JavaScript Browser Binding

Use the BrushApp class in web environments as documented in apps/brush-js/README.md (#L22-L36):

import { BrushApp } from "brush-js";

async function runDemo() {
  const app = new BrushApp();
  await app.init();
  
  const dir = await window.showDirectoryPicker();
  const training = app.startTrainingFromDirectory(
    dir,
    (initialConfig) => initialConfig
  );

  while (true) {
    const msgs = await training.trainSteps(5);
    if (msgs.length === 0) break;
    // Handle TrainStep, RefineStep, EvalResult messages
  }
}
runDemo();

React/TypeScript Integration

Initialize the WASM module in a React application using the pattern from apps/brush-app/web/src/main.ts:

import { useEffect } from "react";
import { initBrushApp, loadDataset } from "brush-app";

function App() {
  useEffect(() => {
    async function start() {
      const app = await initBrushApp();
      await loadDataset(app, "https://example.com/myscene.ply");
    }
    start();
  }, []);
  return <canvas id="brush-canvas" />;
}

Summary

  • Install Rust ≥1.88 with rust-src component before any builds, as required by the workspace Cargo.toml configuration.
  • Desktop builds use cargo run --release from the repository root to compile the CLI defined in apps/brush-cli/Cargo.toml.
  • Web builds require Node.js ≥18 and use npm run dev:lib in apps/brush-js or npm run dev in apps/brush-app/web.
  • Android builds need the NDK, cargo-ndk, and Gradle to compile native libraries to crates/brush-app/app/src/main/jniLibs/ and deploy APKs.
  • Optional tooling includes rerun-cli for real-time training visualization.
  • Key source files include crates/brush-train/src/train.rs for training logic, crates/brush-dataset/src/lib.rs for data loading, and apps/brush-cli/Cargo.toml for the CLI executable definition.

Frequently Asked Questions

What Rust version is required for ArthurBrussee/brush?

Brush requires Rust ≥1.88. Install or update via rustup update stable and add the rust-src component with rustup component add rust-src to ensure compatibility with the build system and dependencies specified in the workspace root.

How do I build the web demo without Android tools?

You do not need Android Studio or the NDK for web builds. Install Node.js ≥18, run npm install in either apps/brush-js or apps/brush-app/web, then execute npm run dev to launch the Vite development server and serve the WASM bundle.

Where is the training loop implemented in the source code?

The core training loop is implemented in crates/brush-train/src/train.rs, which provides the Train struct and async training methods. This crate is consumed by the CLI application configured in apps/brush-cli/Cargo.toml and the WASM bindings.

Can I run the Android app without rebuilding the Rust code every time?

No. The Android Studio project in apps/brush-app does not automatically rebuild Rust sources. You must run cargo ndk commands manually to update the native libraries in crates/brush-app/app/src/main/jniLibs/ before deploying from Android Studio or using Gradle to install the debug APK.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →