# Main Directories Within the src Folder of Brush: Complete Workspace Guide

> Explore the src directories in the Brush Rust workspace. Understand how each crate and app in crates/ and apps/ manages its own independent source code structure for efficient development.

- Repository: [Arthur Brussee/brush](https://github.com/ArthurBrussee/brush)
- Tags: workspace-guide
- Published: 2026-05-14

---

**The brush repository does not use a single root-level `src` folder; instead, it organizes source code as a Rust workspace where every functional crate under `crates/` and application under `apps/` maintains its own independent `src` directory.**

ArthurBrussee/brush is a high-performance Gaussian splatting renderer written in Rust. Rather than consolidating all modules under one monolithic source tree, the codebase distributes implementations across specialized crates. This guide maps every major `src` directory in the repository, covering GPU kernels, training pipelines, and both web and desktop front-ends.

## Core Rendering Engines

The rendering stack splits forward rasterization from backward gradient computation across two dedicated crates.

### Forward Renderer (brush-render/src)

Located at `crates/brush-render/src`, this directory houses the forward renderer, camera utilities, and Gaussian splat rasterization kernels including `rasterize` and `project_forward`. The main library entry point exposes the primary rendering API.

As implemented in ArthurBrussee/brush, the forward render module initializes a device context and executes scene rendering:

```rust
use brush_render::{Renderer, Camera, Scene};

let mut renderer = Renderer::new(&device)?;
let camera = Camera::new(&scene, /*settings*/);
renderer.render(&scene, &camera);

```

*Relevant source*: [[`crates/brush-render/src/render.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-render/src/render.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-render/src/render.rs)

### Backward-Compatible Renderer (brush-render-bwd/src)

Path: `crates/brush-render-bwd/src`

This crate contains the back-propagation rasterizer essential for gradient-based training. The [`render_bwd.rs`](https://github.com/ArthurBrussee/brush/blob/main/render_bwd.rs) file implements differential rendering operations that compute gradients with respect to Gaussian parameters during optimization.

*Relevant source*: [[`crates/brush-render-bwd/src/render_bwd.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-render-bwd/src/render_bwd.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-render-bwd/src/render_bwd.rs)

## Training and Data Pipeline

### Training Loop (brush-train/src)

Path: `crates/brush-train/src`

This directory implements the complete training infrastructure, including the optimization loop, statistics tracking, optimizer state management, and LOD (Level of Detail) handling. The [`train.rs`](https://github.com/ArthurBrussee/brush/blob/main/train.rs) file contains the primary entry point for starting a training session.

Typical usage according to the brush source code:

```rust
use brush_train::{train, Config};

fn main() -> anyhow::Result<()> {
    let cfg = Config::load("config.yaml")?;
    train(&cfg)
}

```

*Relevant source*: [[`crates/brush-train/src/train.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-train/src/train.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-train/src/train.rs)

### Dataset Management (brush-dataset/src)

Path: `crates/brush-dataset/src`

The dataset crate handles loaders for NeRFStudio and COLMAP formats, scene description parsing, and configuration management. The [`scene_loader.rs`](https://github.com/ArthurBrussee/brush/blob/main/scene_loader.rs) file provides the primary interface for ingesting training data from various 3D reconstruction pipelines.

Example implementation:

```rust
use brush_dataset::Dataset;

let dataset = Dataset::load("data/nerfstudio")?;
println!("Loaded {} frames", dataset.frames.len());

```

*Relevant source*: [[`crates/brush-dataset/src/scene_loader.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-dataset/src/scene_loader.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-dataset/src/scene_loader.rs)

## Serialization and System Utilities

### Scene Serialization (brush-serde/src)

Path: `crates/brush-serde/src`

This crate manages export and import of `.ply` and `.ply_gaussian` file formats, along with quantization utilities for efficient model storage. The [`export.rs`](https://github.com/ArthurBrussee/brush/blob/main/export.rs) file handles the serialization logic for trained Gaussian scenes.

*Relevant source*: [[`crates/brush-serde/src/export.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-serde/src/export.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-serde/src/export.rs)

### Inter-Process Messaging (brush-process/src)

Path: `crates/brush-process/src`

Implements the message-passing architecture between UI threads, training workers, and render workers. The [`message.rs`](https://github.com/ArthurBrussee/brush/blob/main/message.rs) file defines the protocol for communication across asynchronous boundaries in the application.

*Relevant source*: [[`crates/brush-process/src/message.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-process/src/message.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-process/src/message.rs)

### Virtual Filesystem (brush-vfs/src)

Path: `crates/brush-vfs/src`

Provides a unified virtual file-system abstraction capable of loading assets from local disk, zip archives, or remote URLs. This enables the application to work with datasets packaged in various formats without code changes.

*Relevant source*: [[`crates/brush-vfs/src/lib.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-vfs/src/lib.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-vfs/src/lib.rs)

## Mathematical and GPU Utilities

### Loss Functions (brush-loss/src)

Path: `crates/brush-loss/src`

Implements perceptual and pixel-wise loss functions including LPIPS (Learned Perceptual Image Patch Similarity), SSIM (Structural Similarity Index), and standard L2 loss utilities used during training optimization.

*Relevant source*: [[`crates/brush-loss/src/lib.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-loss/src/lib.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-loss/src/lib.rs)

### GPU Sorting and Scan Operations

Two specialized crates provide fundamental GPU algorithms:

- **brush-sort/src** (`crates/brush-sort/src`): GPU-accelerated radix sort implementation for ordering Gaussian primitives by depth
- **brush-prefix-sum/src** (`crates/brush-prefix-sum/src`): Parallel prefix sum (scan) kernels for cumulative distribution calculations

*Relevant source*: [[`crates/brush-sort/src/kernels.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-sort/src/kernels.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-sort/src/kernels.rs)

## Application Front-Ends

### Desktop Application (brush-app/src)

Path: `apps/brush-app/src`

This directory contains the Rust and WebAssembly-based desktop UI, implementing widgets, camera orbit controls, and training control panels. The [`ui/mod.rs`](https://github.com/ArthurBrussee/brush/blob/main/ui/mod.rs) file organizes the interface modules, while [`training_panel.rs`](https://github.com/ArthurBrussee/brush/blob/main/training_panel.rs) provides the interactive training dashboard.

Integration example from the source:

```rust
use brush_app::ui::TrainingPanel;

let panel = TrainingPanel::new();
panel.start_training("config.yaml");

```

*Relevant sources*: [[`apps/brush-app/src/ui/mod.rs`](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-app/src/ui/mod.rs)](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-app/src/ui/mod.rs), [[`apps/brush-app/src/ui/training_panel.rs`](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-app/src/ui/training_panel.rs)](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-app/src/ui/training_panel.rs)

### Command Line Interface (brush-cli/src)

Path: `apps/brush-cli/src`

Provides the CLI entry point that parses command-line arguments and forwards them to the appropriate training or rendering crates. This allows headless operation without the UI layer.

*Relevant source*: [[`apps/brush-cli/src/lib.rs`](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-cli/src/lib.rs)](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-cli/src/lib.rs)

### Web Demo (brush-js/web/src)

Path: `apps/brush-js/web/src`

A TypeScript front-end for the browser-based demo, featuring the point renderer implementation and web-specific entry points.

*Relevant sources*: [[`apps/brush-js/web/src/point_renderer.ts`](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-js/web/src/point_renderer.ts)](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-js/web/src/point_renderer.ts), [[`apps/brush-js/web/src/main.ts`](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-js/web/src/main.ts)](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-js/web/src/main.ts)

## Supporting Tools

### Web File Dialogs (rrfd/src)

Path: `crates/rrfd/src`

The Random Forest File Dialog (RRFD) utility crate supports file selection dialogs when running the application in web environments where native system dialogs are unavailable.

*Relevant source*: [[`crates/rrfd/src/lib.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/rrfd/src/lib.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/rrfd/src/lib.rs)

### LPIPS Model Converter (lpips-convert/src)

Path: `crates/lpips-convert/src`

A small binary utility that converts pre-trained LPIPS models from Python frameworks into a Rust-compatible format for use with the `brush-loss` crate.

*Relevant source*: [[`crates/lpips-convert/src/main.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/lpips-convert/src/main.rs)](https://github.com/ArthurBrussee/brush/blob/main/crates/lpips-convert/src/main.rs)

## Summary

- **brush-render/src** and **brush-render-bwd/src** provide the differentiable rendering pipeline required for Gaussian splatting
- **brush-train/src** and **brush-dataset/src** implement the complete training loop and data ingestion for NeRFStudio/COLMAP formats
- **brush-serde/src**, **brush-process/src**, and **brush-vfs/src** handle serialization, thread messaging, and filesystem abstraction
- **brush-sort/src**, **brush-prefix-sum/src**, and **brush-loss/src** supply GPU-accelerated primitives and loss metrics
- **brush-app/src**, **brush-cli/src**, and **brush-js/web/src** provide desktop, command-line, and web interfaces respectively

## Frequently Asked Questions

### Why does brush use multiple src directories instead of one root src folder?

The brush project uses a Cargo workspace architecture where each crate is an independent compilation unit with its own `src` directory. This modularity allows specific components like the renderer or dataset loader to be versioned, tested, and potentially reused independently of the full application stack.

### What is the difference between brush-render and brush-render-bwd?

**brush-render/src** implements the forward rasterization pass that projects Gaussians to 2D and computes pixel colors, while **brush-render-bwd/src** implements the backward pass that propagates gradients from the loss function back to the Gaussian parameters during training. Both are required for differentiable rendering.

### How do I run training from the command line using the src directories?

Training is initiated through the **brush-cli/src** crate, which exposes command-line arguments that forward to **brush-train/src**. The CLI entry point in [`apps/brush-cli/src/lib.rs`](https://github.com/ArthurBrussee/brush/blob/main/apps/brush-cli/src/lib.rs) parses arguments and invokes the training loop defined in [`crates/brush-train/src/train.rs`](https://github.com/ArthurBrussee/brush/blob/main/crates/brush-train/src/train.rs).

### Where is the web UI source code located?

The web interface source resides in **apps/brush-js/web/src**, written in TypeScript. This is distinct from the desktop UI in **apps/brush-app/src**, which uses Rust and WebAssembly compiled from the `brush-app` crate.