generate-glb-rs — Zero-Dependency Binary glTF 2.0 (.glb) Compiler in Pure Rust
generate-glb-rs is a pure Rust library and CLI that compiles procedural 3D meshes, vertex colors, normals, and PBR materials directly into spec-compliant Khronos glTF 2.0 binary (.glb) files. It eliminates heavy Python, Trimesh, and Blender dependencies with deterministic 4-byte chunk alignment and sub-millisecond serialization.
$ cargo install generate-glb-rs
Architected for Speed & Reliability
Engineered from the ground up in memory-safe Rust with zero unnecessary dependencies.
Zero Heavy Python Stack
Eliminates multi-gigabyte virtual environments, CUDA wheel conflicts, and NumPy / Trimesh installation nightmares with a single compiled Rust binary.
Multi-LLM Backends
Seamlessly generates meshes through local Ollama instances streaming LLaMA-Mesh GGUF, OpenAI-compatible APIs (vLLM / LM Studio), or offline procedural generators.
Live Terminal Mesh Streaming
Streams vertices (v) and faces (f) live to your terminal as they are inferred, with real-time progress counters and vertex velocity.
Y-Axis Gradient Shading
Calculates normalized height gradient vertex colors automatically, rendering gorgeous multi-colored preview models in engines without requiring texture UVs.
Direct Binary GLB Export
Encodes spec-compliant binary glTF 2.0 files with compact binary buffers, indices, and material headers ready to drag-and-drop into Godot, Blender, or Three.js.
Embedded 3D Web Viewer
Launch an embedded local HTTP server with interactive Three.js 3D viewport and Ollama-compatible `/api/generate` streaming endpoint.
Get Started in Seconds
Install via Cargo and run immediately on macOS, Linux, or Windows.
# Install generate-glb-rs
cargo install --git https://github.com/bhubbard/generate-glb-rs
# Generate a 3D model using local Ollama LLaMA-Mesh
generate-glb -p "a low-poly medieval chest" -o chest.glb
# Generate using an OpenAI-compatible API
generate-glb --backend openai --api-base http://localhost:8000/v1 -p "racing helmet" -o helmet.glb
# Start the interactive 3D Web Viewer and API server
generate-glb serve --port 8080
Engine Architecture
Streamlined execution pipeline with deterministic memory isolation and zero runtime overhead.
┌───────────────────────────────────────────────────────────┐
│ Text Prompt: "a low-poly chest" │
└─────────────────────────────┬─────────────────────────────┘
│ HTTP Stream
┌─────────────────────────────▼─────────────────────────────┐
│ Backend: Ollama / vLLM / LM Studio / Mock │
└─────────────────────────────┬─────────────────────────────┘
│ Streaming OBJ Tokens: v & f
┌─────────────────────────────▼─────────────────────────────┐
│ generate-glb-rs Pipeline │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────┐ │
│ │ Stream OBJ Parser│ │ Y-Gradient Shader│ │ GLB 2.0 │ │
│ │ (Zero Alloc Buf) │ │ (Norm Heights) │ │ Exporter │ │
│ └──────────────────┘ └──────────────────┘ └──────────┘ │
└─────────────────────────────┬─────────────────────────────┘
│ Spec-Compliant Binary
┌─────────────────────────────▼─────────────────────────────┐
│ Output: chest.glb (Blender / Godot / Web) │
└───────────────────────────────────────────────────────────┘