Dioxus Three
A Dioxus wrapper around Three.js for building cross-platform 3D applications in Rust.
⚠️ Pre-alpha: Active development. APIs will change.
Overview
Dioxus Three provides a Dioxus component that embeds a Three.js 3D viewer, allowing you to:
- Load and display 3D models (GLB, GLTF, OBJ, FBX, STL, PLY, Collada, 3MF)
- Render multiple models in a single scene
- Apply custom vertex/fragment shaders
- Control camera, lighting, and scene settings
- Interact with the scene via pointer events and selection
- Manipulate objects with transform gizmos (translate, rotate, scale)
Features
| Feature | Status | Description |
|---|---|---|
| Model Loading | ✅ Ready | GLB, GLTF, OBJ, FBX, STL, PLY, Collada, 3MF |
| Multiple Models | ✅ Ready | Render multiple models in one scene |
| Camera Control | ✅ Ready | Orbit controls, custom positions |
| Shader Support | ✅ Ready | Custom vertex/fragment shaders |
| Desktop (WebView) | ✅ Ready | Tauri/WebView on macOS, Linux, Windows |
| Web (WASM) | ✅ Ready | WASM + Three.js canvas |
| Mobile (WebView) | 🔄 Partial | WebView-based, iOS/Android |
| Selection | ✅ v0.0.3 | Click to select objects, multi-select with Shift |
| Gizmos | ✅ v0.0.3 | Translate, Rotate, Scale handles |
| Pointer Events | ✅ v0.0.3 | on_pointer_down, on_pointer_move, on_pointer_up |
| Raycasting | ✅ v0.0.3 | Hit detection for clicks and hovers |
| Animation | 🔄 Planned | Keyframe and procedural animation |
| Physics | 🔄 Planned | Rapier.js integration |
| Post-Processing | 🔄 Planned | Bloom, SSAO, etc. |
Installation
Add to your Cargo.toml:
[]
= "0.0.4"
= "0.6"
Or use the git version for the latest:
[]
= { = "https://github.com/eftech93/dioxus-three" }
Quick Start
use *;
use ;
Examples
Selection & Gizmos
use *;
use ;
Custom Shader
ThreeView
Multiple Models
ThreeView
Platform Notes
Desktop (macOS, Linux, Windows)
Uses a WebView iframe with Three.js loaded from CDN. Includes:
- Full orbit camera controls
- Official
THREE.TransformControlsfor gizmos (translate, rotate, scale) - Pointer events via
document::evalbridge - State updates via
postMessage(no iframe reload on camera/selection/gizmo changes) - Selection outline with wireframe box + inner glow
- Gizmo handles always render on top via
depthTest: false
Web (WASM)
Renders Three.js directly to a <canvas> element:
- Native canvas rendering
- Custom-built gizmos using Three.js primitives (arrows, tori, boxes)
- Manual raycasting and drag math
- Bridge via
wasm_bindgenclosures (dioxusThreeRustBridge) - Same selection and gizmo features as Desktop
- Gizmo handles always render on top via
depthTest: false
Mobile
Uses WebView approach similar to Desktop. Gizmo features available but not yet fully tested.
Documentation
- API Reference - Component props and types
- Guides - How-to guides
- Architecture - Internal design
- Changelog - Version history
Contributing
Contributions are welcome! See CONTRIBUTING.md.
License
MIT License - see LICENSE file.