Skip to content

Architecture ​

Crate Structure ​

unshape/
├── crates/
│   ├── unshape/           # umbrella, re-exports all domain crates
│   ├── rhi-unshape-core/      # shared types, traits, math utilities
│   ├── rhi-unshape-mesh/      # 3D mesh generation and manipulation
│   ├── rhi-unshape-audio/     # audio synthesis and processing
│   ├── rhi-unshape-texture/   # procedural texture generation
│   ├── rhi-unshape-vector/    # 2D vector graphics
│   └── rhi-unshape-rig/       # rigging and animation
└── docs/                # VitePress documentation

Core Concepts ​

Graphs ​

Operations are composed as directed acyclic graphs (DAGs):

Noise -> Threshold -> Displace
              ↓
           Sphere -> Output

Evaluation is lazy - the graph is a description, computed on demand.

Attributes ​

Data attached to geometric elements:

  • Per-vertex: position, normal, UV, color
  • Per-edge: crease, seam
  • Per-face: material ID, smooth group

Attributes flow through operations, transformed as appropriate.

Parameters ​

All operations expose parameters:

  • Scalar values
  • Expressions (computed at evaluation time)
  • Animated values (function of time)
  • Data-driven (from external sources)

Why glam? ​

We use glam for math types (Vec2, Vec3, Quat, Mat4, etc.) because:

  • Bevy compatible: bevy uses glam internally, so types work directly without conversion
  • Pure Rust: no C dependencies, easy cross-compilation
  • SIMD optimized: good performance on supported platforms
  • Minimal: does one thing well, few dependencies

Alternatives considered:

  • nalgebra: more features but heavier, different API than bevy
  • ultraviolet: similar to glam but less ecosystem adoption
  • cgmath: older, less maintained

Bevy Integration ​

Types implement standard conversion traits:

rust
// unshape mesh -> bevy mesh
let bevy_mesh: bevy::render::mesh::Mesh = unshape_mesh.into();

// glam types used directly (shared with bevy)
let pos: glam::Vec3 = vertex.position;

No bevy dependency in core - conversions live in optional feature flags or adapter crates.