๐ฅ EngineRenderer ๐ฅ
A zero-dependency offline rendering engine in pure Rust
CPU Path Tracing ยท BVH Acceleration ยท 16-Band Spectral Rendering ยท PBR Materials ยท Animation & Video
478 source files ยท ~49,060 lines ยท 17 material presets ยท 18 interpolation curves ยท 9+ targets
๐จ Features
Rendering Pipeline
| ๐ฆ Path Tracing | Configurable SPP (1โ64+), multi-bounce, BVH-accelerated |
| ๐ Spectral | 16-band wavelength dispatch, CIE 1931 XYZ conversion |
| ๐ชฉ PBR Materials | Albedo ยท roughness ยท metallic ยท emission ยท IOR ยท subsurface ยท anisotropy ยท iridescence ยท clearcoat ยท transmission |
| ๐ญ 17 Presets | Stellar ยท planetary ยท manufactured ยท celestial ยท natural |
| ๐ก Lighting | Area lights ยท soft shadows ยท cascaded shadow maps (PCF + contact) |
| ๐ซ๏ธ Volumetrics | God rays ยท participating media ยท atmospheric scattering ยท clouds |
| โจ Post-Processing | Bloom ยท blur ยท depth-of-field (physical lens) ยท tone mapping |
| ๐๏ธ Motion Blur | Time-sampled primitives |
| ๐ฏ Optimization | Adaptive sampling ยท firefly rejection ยท denoising ยท frustum culling ยท LOD |
Render Presets
AnimationFast ยทยทยทยทยทยทยทยทยท 1 SPP ยท 1 bounce ยท denoised previews
PreviewCpu ยทยทยทยทยทยทยทยทยทยทยทยท 4 SPP ยท 1 bounce ยท adaptive sampling
UltraHdCpu ยทยทยทยทยทยทยทยทยทยทยทยท 16 SPP ยท 3 bounces ยท high-quality stills
ProductionReference ยทยทยท 64 SPP ยท max bounces ยท reference quality
Realtime 120 FPS Profile
EngineRenderer includes a unified ultra-constrained realtime profile for --fps 120.
- Scene-side budget: proxy showcase geometry, reduced light budget, optional panorama removal
- Runtime-side budget: cached showcase meshes, static realtime scene reuse, BVH reuse
- Loop-side budget: deadline-based frame pacing with drift compensation
- Runtime adaptation: smoothed quality bias, sample pressure, scheduler granularity, and hysteresis-based internal resolution scaling
Validated runtime benchmarks (release, 3 seconds, --fps 120 --width 1280 --height 720):
- Linux x86_64: stable high-frequency cadence with adaptive runtime controls
- Android ARM64: constrained-device adaptation validated with dynamic internal resolution and scheduler tuning
๐ฌ Animation
| โฑ๏ธ Timeline keyframes | Camera ยท sun ยท sky ยท exposure |
| ๐ 18 interpolations | Linear ยท Step ยท SmoothStep ยท Hermite ยท EaseIn/Out/InOut (Quad, Cubic, Sine, Expo) ยท Back ยท Bounce |
| ๐๏ธ Frame sequencer | Batch rendering with caching |
| ๐น Video export | MP4 via system FFmpeg |
๐๏ธ Scene Building
| ๐ Fluent API | SceneBuilder ยท MaterialBuilder ยท CameraController |
| ๐ Scene format | Text-based .scene files with serialization & parsing |
| ๐ฆ Mesh import | OBJ ยท glTF/GLB |
| ๐ง Procedural | Geometry generators ยท mesh operations ยท composite objects |
โ๏ธ Physics & Simulation
| ๐ฅ Rigid bodies | Constraint solving ยท collision detection ยท raycasting |
| ๐ช N-body | Gravitational simulation for celestial mechanics |
๐ค AI Integration
| ๐ Introspection | Capabilities::discover() โ JSON feature description |
| ๐ฌ Prompt-to-scene | Natural language โ renderable scene |
| ๐ท Camera presets | Front ยท top-down ยท dramatic ยท cinematic ยท closeup |
๐งฉ Runtime Subsystems
| ๐ง Scripting VM | Stack-based bytecode VM with Push ยท Add/Sub/Mul/Div ยท Jmp/JmpIf ยท Eq/Ne/Lt/Gt/Le/Ge ยท Call/Ret ยท Load/Store ยท Neg/Not ยท CallNative |
| ๐ Script runner | ScriptRunner compiles expressions and dispatches to the VM with native function registration |
| ๐ Hot reload | HotReloader watches script files and triggers ScriptRunner::load_from_file on change |
| ๐งฌ ECS | Sparse-set TypedStorage<T> ยท ComponentRegistry ยท entity spawn/remove with type-erased component storage |
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ API Layer โ
โ SceneBuilder ยท MaterialCatalog ยท CameraController โ
โ AnimationClip ยท Timeline ยท FrameSequencer โ
โ AiRenderer ยท Capabilities ยท SceneDescriptor โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Core Engine โ
โ Path Tracer ยท BVH ยท Spectral Shading ยท Shadow Maps โ
โ Volumetrics ยท Post-Processing ยท Scene Graph ยท Physics โ
โ Animation Sequencer ยท Video Exporter ยท Scheduler โ
โ ECS (TypedStorage) ยท Scripting VM ยท Hot Reload โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ Hardware Abstraction Layer โ
โ CPU (topology, SIMD) ยท GPU (DRM/D3D12) ยท Display ยท DMA โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Full module breakdown: arborescence.md
๐ Cross-Platform Support
Targets
| Target | Arch | OS |
|---|---|---|
x86_64-unknown-linux-gnu |
x86_64 | Linux |
i686-unknown-linux-gnu |
x86 | Linux |
aarch64-unknown-linux-gnu |
ARM64 | Linux |
armv7-unknown-linux-gnueabihf |
ARMv7 | Linux |
x86_64-apple-darwin |
x86_64 | macOS Intel |
aarch64-apple-darwin |
ARM64 | macOS Silicon |
x86_64-pc-windows-gnu |
x86_64 | Windows |
i686-pc-windows-gnu |
x86 | Windows |
aarch64-linux-android |
ARM64 | Android |
- musl variants for static linking
โ All listed targets compile successfully.
โ
cargo clippy --target x86_64-pc-windows-gnu passes cleanly.
SIMD Detection
| ISA | Extensions |
|---|---|
| x86 / x86_64 | SSE4.2 ยท AVX ยท AVX-512 |
| ARM / AArch64 | NEON ยท SVE |
| Fallback | Scalar paths |
GPU Drivers
| OS | Drivers |
|---|---|
| Linux | amdgpu radeon i915 xe nouveau mali msm |
| Windows | D3D12 / DXGI |
| macOS | AppleGPU ยท Intel iGPU |
Automatic CPU fallback if no GPU available
๐จ Building
| Dependency | Required | Notes |
|---|---|---|
| Rust | โ | Edition 2024 |
| FFmpeg | โ | Only for MP4 export |
Quick start: quickstart.md
๐ Usage
CLI Mode
Detect / Debug options
Supported values:
--component:cpu,gpu,ram,display,all--override:arch=x86|arm,os=linux|windows|macos,vendor=amd|intel|apple|unknown
Interactive Terminal
Launch with no arguments for a full REPL with module navigation and built-in docs:
โญโโโโโโโโโ Root Namespace โโโโโโโโโโฎ
โ ๐Welcome in Helper๐ โ
โ โ
โ ๐ฆ Modules: โ
โ ๐ง ai ๐ฌ animation โ
โ ๐ท camera โ engine โ
โ ๐จ materials ๐ฆ objects โ
โ ๐ scenes ๐งฉ types โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
| Command | Description |
|---|---|
open <module> |
Enter a module namespace |
call <fn> |
Execute a function |
inspect <item> |
Show details |
docs [target] [section] |
Browse source documentation |
animate [topic] |
Show execution flow |
back |
Return to root |
clear |
Clear screen |
exit |
Quit |
engine โ call render ยท call gallery ยท call test ยท call run
animation โ call spheres ยท call cubes ยท call house ยท call city ยท call car ยท call world ยท call blackhole
The REPL reads source code directly:
engine> docs # List all topics
engine> docs readme # README
engine> docs tree # Project structure
engine> docs changelog # Changelog
engine> docs rendering # Rendering pipeline
engine> docs ai.renderer # Sub-module docs
engine> docs ai.prompt constraints # Section filter
Sections: overview ยท constraints ยท implementation ยท tips
Render Examples
Standalone GPU example binaries live in examples/:
CPU gallery scenes (spheres, cubes, house, city, car, world, blackhole) are exposed via the gallery command and the REPL:
engine> open animation
animation> call spheres # or cubes ยท house ยท city ยท car ยท world ยท blackhole
๐ Rendu vidรฉo / Animation
Le mode video gรฉnรจre une animation MP4 ร partir d'une scรจne :
Chargement d'une scรจne existante :
| Option | Dรฉfaut | Description |
|---|---|---|
--duration=N |
5 |
Durรฉe en secondes |
--fps=N |
30 |
Images par seconde |
--width=N |
1280 |
Largeur en pixels |
--height=N |
720 |
Hauteur en pixels |
--quality=preview|hd|production |
preview |
Qualitรฉ de rendu |
--scene-file=PATH |
(dรฉfaut) | Scรจne .scene ร charger |
--output-dir=PATH |
output/video |
Dossier frames temporaires |
--output-mp4=PATH |
output/video/animation.mp4 |
Fichier MP4 final |
--prefix=NAME |
frame |
Prรฉfixe des frames |
โ Validation Suite
The workspace includes rendering validation tests under tests/workspace_render_validation.rs:
- Visual determinism regression for preview outputs
- Parallel stress rendering over multiple workers
- Long-run pacing campaign (ignored by default)
- Diagnostics benchmark matrix campaign (ignored by default)
Run the standard suite:
Run the dedicated workspace validation file:
Run ignored long campaigns explicitly:
Core quality gates used in this workspace:
Latest status (see ChangeLog.md 0.0.1):
cargo clippyclean onx86_64-unknown-linux-gnu(0 warnings)- Scripting VM dispatch covers
CallNativeend-to-end (encode โ decode โ execute โ native dispatch โVmError::UnknownNativereporting viaDisplay) - ECS
TypedStorage::component_countexposed via both inherent and trait surfaces - Hot-reload runtime log reports
watched_paths()and per-scriptis_loaded(...)
๐ฆ Library API
use Engine;
use SceneBuilder;
use MaterialCatalog;
use RenderPreset;
use ;
Default render:
let report = default.run?;
println!;
Production gallery:
let reports = production_reference.render_gallery?;
for report in reports
Smoke test:
let report = test_minimal.run?;
AI capabilities:
let caps = discover;
Hardware diagnostics:
diagnose_compute_environment;
๐ Output Formats
| Format | Extension | Notes |
|---|---|---|
| PPM | .ppm |
Default still image |
| EXR | .exr |
HDR framebuffer |
| PNG | .png |
Compressed stills |
| MP4 | .mp4 |
Video (FFmpeg) |
๐ Stats
| Source files | Lines of Rust | External crates | Material presets | Interpolation curves | Render presets | Targets | Edition |
|---|---|---|---|---|---|---|---|
| 478 | ~49,060 | 0 | 17 | 18 | 4 | 9+ | 2024 |