Realism
The High-Performance, Scoped Scene Graph for Modern Rust Engines.
realism is a data-oriented scene management library designed for engines requiring high-density entity counts and seamless world-scale streaming. It provides the high-performance "glue" between simulation and rendering hardware.
โก Performance Matrix (Latest Benchmarks)
Benchmarks performed on Intel Core i5-11400F, Intel Arc A380, 16GB DDR4 RAM.
| Operations (100k Entities) | Throughput / Mean Time | Optimization Path |
|---|---|---|
| Transform Propagation | 1.36 ms | SIMD Vectorized (4x Batch) |
| Spatial Selection (Visible) | 760 ยตs | Dynamic Octree (65k Cull) |
| Entity Spawn/Despawn | O(1) | Generational Dense List |
| Component Access | O(1) | Cache-Optimized Sparse Set |
๐ Core Value Propositions
- โก SIMD-Accelerated Math: Leveraging Nightly Rust's
portable_simd, Realism batches transform composition to process 100,000+ entities with unparalleled speed. - ๐ World-Scale Streaming: Integrated async chunk management for seamless world loading/unloading, built-in memory monitoring, and thread-safe asset integration.
- ๐ณ Dynamic Spatial Index: A loose/dynamic Octree handles frustum culling and spatial queries, ensuring only visible data reaches your GPU.
- ๐๏ธ Engine Agnostic Architecture:
- Generic Physics Bridge: Decoupled traits for Rapier, Jolt, or custom physics synchronization.
- Render Extraction: Extracts a pure command stream (
RenderCommand) ready for Vulkan, WGPU, or Dx12.
- ๐ฆ Industrial-Grade Serialization: Native JSON and binary support for world snapshots and modular prefabs.
โ๏ธ Installation
Add to your Cargo.toml. To enable SIMD optimizations, use a Nightly Rust toolchain.
[]
= "0.1.0"
= "0.29"
๐ API Usage Examples
1. Basic Scene Setup
use Scene;
use Transform;
use Vec3;
let mut scene = new;
// Spawn a hierarchy: Parent (0, 10, 0) -> Child (5, 0, 0)
let parent = scene.spawn_with_transform;
let child = scene.spawn_with_transform;
scene.attach;
// SIMD Propagation computes World Matrices for the entire hierarchy in batches of 4
scene.propagate_transforms;
let world_pos = scene.transform.unwrap.cached_world_transform.w_axis.truncate;
assert_eq!;
2. Physics & Render Extraction
// 1. Sync transforms with your physical world (Rapier, Jolt, etc.)
scene.sync_physics;
// 2. Extract visible command stream for the current frame
let view_proj = camera.view_projection;
let draw_calls = scene.extract;
renderer.draw;
3. World-Scale Streaming
use ;
let mut manager = new; // Load radius, Unload radius
manager.update;
for id in manager.chunks_to_load
// Poll background thread results and integrate into Scene
let loaded = loader.poll;
integrate_chunks;
๐ก๏ธ Architecture
For a deep dive into the internal sparse set storage, Octree heuristics, and SIMD batching logic, refer to the Internal Guide.
๐ License
Licensed under Apache License, Version 2.0.