ferrum-wgpu
A 3D rendering engine library built with Rust and wgpu (WebGPU).
Cross-platform PBR rendering engine that runs on desktop (Windows, Linux, macOS), browser (WebAssembly via WebGPU) and Raspberry Pi.
Installation
Or in Cargo.toml:
[]
= { = "ferrum-wgpu", = "0.1" }
Features
| Feature | Default | Description |
|---|---|---|
rpi |
no | Enables OpenGL ES backend for Raspberry Pi. Disables Vulkan/Metal/DX12. |
Enable with:
= { = "ferrum-wgpu", = "0.1", = ["rpi"] }
Quick Start
use ;
// Create the engine state (requires a winit Window or equivalent handle)
let state = new.await?;
// Load a 3D model
let _model = state.spawn_model;
// Main loop
loop
API Overview
| Method | Description |
|---|---|
State::new(window, size) |
Initialize GPU device, surface, pipelines and sky |
state.spawn_model(desc) |
Async-load a .obj model and add it to the scene |
state.evolbe() |
Per-frame tick: collect loaded models, update uniforms |
state.render() |
Submit render pass and present the frame |
state.render_with_overlay(callback) |
Render with an egui overlay pass |
state.set_wind(direction, intensity) |
Set wind vector that animates foliage |
state.resize(width, height) |
Handle window resize |
Capabilities
- PBR rendering with diffuse/specular lighting, tangent-space normal maps, HDR pipeline and ACES tonemapping
- Skybox from equirectangular HDR/EXR images converted to cubemap via compute shaders
- Animated directional light with orbital rotation and shadow maps
- Instancing for efficient multi-object rendering
- Free camera with WASD / arrow key controls
- Async resource loading on both native and WASM targets
Graphics Backends
| Platform | Backend |
|---|---|
| Windows / macOS / Linux | Vulkan, Metal, DX12 |
| Web (WASM) | WebGPU (required — not WebGL2) |
| Raspberry Pi | OpenGL ES (enable rpi feature) |
Demo & Source
Full project, live demo and Raspberry Pi integration: github.com/karlosvas/ferrum
License
GNU General Public License v3.0 — see LICENSE.