bevy-sensor
A Bevy library and CLI for capturing multi-view images of 3D OBJ models, designed for Thousand Brains Project compatible sensor simulation.
Features
- Multi-viewpoint capture using spherical coordinates
- Object rotation support matching TBP benchmark formats
- Library API for integration with neocortx
- Programmatic YCB model downloads via ycbust (v0.2.4)
- Pre-configured TBP benchmark and training configurations
Requirements
- Rust 1.70+
- Bevy 0.15
- GPU with Vulkan support (required for headless rendering on WSL2/Linux)
Setup
Getting YCB Models
Programmatically (recommended):
use ;
// Download representative subset (3 objects)
download_models.await?;
// Or download 10 objects for TBP benchmark testing
download_models.await?;
The assets/ycb symlink points to /tmp/ycb.
Usage
CLI
Default configuration captures 72 images (3 rotations × 24 viewpoints) matching TBP benchmark format.
Library
use ;
// TBP benchmark: 3 rotations × 24 viewpoints = 72 captures
let config = tbp_benchmark;
// Full training: 14 rotations × 24 viewpoints = 336 captures
let config = tbp_full_training;
// Custom configuration
let config = SensorConfig ;
YCB Utilities
use ;
// Check if models are downloaded
if !models_exist
// Get paths to object files
let mesh = object_mesh_path;
let texture = object_texture_path;
// List available objects
for obj in REPRESENTATIVE_OBJECTS
TBP Alignment
| TBP Benchmark | bevy-sensor |
|---|---|
3 known rotations [0,0,0], [0,90,0], [0,180,0] |
ObjectRotation::tbp_benchmark_rotations() |
| 14 known orientations (faces + corners) | ObjectRotation::tbp_known_orientations() |
| Distant agent look up/down | Pitch angles: -30°, 0°, +30° |
| Turn left/right | 8 yaw positions @ 45° intervals |
Headless Rendering
For headless GPU rendering on WSL2/Linux, use the Vulkan backend:
WGPU_BACKEND=vulkan
The library uses true headless rendering with RenderTarget::Image - no display or window surface required.
Output
Files are saved as capture_{rotation}_{viewpoint}.png:
- Rotation 0: identity
[0,0,0] - Rotation 1: 90° yaw
[0,90,0] - Rotation 2: 180° yaw
[0,180,0] - Viewpoints 0-23: spherical positions around object
License
MIT