Voxel engine in Rust - wgpu compute raymarching, DAG-compressed sparse voxel worlds, GTAO, optional DLSS/FSR upscaling
- Rust 85.5%
- WGSL 13.9%
- PowerShell 0.4%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .codex/skills | ||
| assets | ||
| crates | ||
| scripts | ||
| .claude | ||
| .gitattributes | ||
| .gitignore | ||
| AGENTS.md | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| README.md | ||
Capy
A voxel game/engine written in Rust, built around a GPU raymarched voxel renderer. Successor to an earlier public voxel_renderer prototype, now split into a proper multi-crate workspace.
How it works
- Renderer (
crates/render): wgpu + WGSL compute-shader raymarcher. Rays are walked through the voxel world with a chunk-level DDA, against a sparse voxel tree (crates/world) that reduces duplicate subtrees into a DAG for compact GPU-resident storage. - Passes: primary ray trace + shadow rays + reflection rays into a G-buffer, screen-space GTAO for ambient occlusion, a lighting pass (with underwater/water-surface screen-space distortion, water shading), and a final blit to present.
- Upscaling: optional NVIDIA DLSS and AMD FSR support behind Cargo feature flags (
dlss,fsr); off by default and not required to build or run. - World: terrain is generated on the CPU (
crates/world) from a heightfield and baked into a sparse64tree/DAG structure; a separateworld_editorbinary (egui-based) lets you paint, mask, and place voxels and saves edits to disk as region/chunk files (crates/assets). - Engine: a small plugin-based ECS engine (
bevy_ecs) that owns the window (winit), input, and schedule;gameandworld_editorare the two binaries wired on top of it.net,physics, anduiare present as workspace crates but are mostly scaffolding today.
Status
Personal project, work in progress. APIs, file formats, and shader structure change frequently. Not optimized for external contributors; expect rough edges, especially around the optional DLSS/FSR builds which require vendor SDKs not included in this repo.
Requirements
- Rust (edition 2024, so a recent stable toolchain, e.g. 1.85+).
- A GPU/driver with Vulkan, DX12, or Metal support (via wgpu).
- Windows-only for the
dlssandfsrCargo features (they link against the NVIDIA DLSS SDK / requireDLSS_SDK+VULKAN_SDKenv vars, and static DXC for FSR). Not needed for a normal build.
Build & run
This is a Cargo workspace with no root binary, so pick one of the two binaries explicitly:
cargo run --release -p capy_game # the game
cargo run --release -p capy_world_editor # the voxel world editor
Controls (game)
W/A/S/D— moveSpace/Left Shift— move up / down- Mouse — look around
Controls (world editor)
Uses an egui-based tool UI (brushes, masks, color picker, path/place tools) with its own shortcut set defined in crates/world_editor/src/systems/shortcuts.rs.