| Crates.io | mimesis |
| lib.rs | mimesis |
| version | 0.2.0 |
| created_at | 2025-05-26 11:44:43.934284+00 |
| updated_at | 2025-05-28 21:42:25.88772+00 |
| description | Generate 3D meshes from images using contour tracing and polygon extrusion. |
| homepage | |
| repository | https://github.com/fveilly/mimesis |
| max_upload_size | |
| id | 1689453 |
| size | 1,400,465 |
Generate 3D meshes from images using contour tracing and polygon extrusion.
| Step | Description | Image |
|---|---|---|
| 1️⃣ | Original Image | ![]() |
| 2️⃣ | Binary Mask | ![]() |
| 3️⃣ | Polygon Contour (smoothed) | ![]() |
| 4️⃣ | Extruded 3D Mesh | ![]() |
| 5️⃣ | Vertex View | ![]() |
cargo build --release
# Process a single image
./mimesis -i texture.png -o output/
# Process with custom mask
./mimesis -i texture.png -m mask.png -o output/
# Batch process directory
./mimesis -i images/ -o output/
Generate a default configuration file:
./mimesis --generate-config -c config.json
Use configuration file:
./mimesis -c config.json
-i, --input <PATH> - Input image file or directory-m, --mask <PATH> - Optional binary mask image-o, --output <PATH> - Output directory-c, --config <PATH> - Configuration file path--onnx-background-removal - Enable ONNX background removal--onnx-model-path - Path to the ONXX model--simplify-tolerance <FLOAT> - Polygon simplification tolerance (default: 10.0)--smooth-iterations <INT> - Number of smoothing iterations (default: 1)--extrude-height <FLOAT> - 3D extrusion height (default: 20.0)--min-polygon-dimension <INT> - Minimum polygon size in pixels (default: 0)--threshold <INT> - Binary mask threshold 0-255 (default: 128)--mask-method <METHOD> - Mask generation method: alpha, luminance, red, green, blue (default: alpha)--include-patterns <PATTERNS> - File patterns to include (e.g., ".png,.jpg")--exclude-patterns <PATTERNS> - File patterns to exclude--workers <INT> - Number of parallel workers (default: 1)--continue-on-error - Continue processing if some files fail--side-texture <PATH> - Custom side texture file--back-texture <PATH> - Custom back texture file--skip-intermediates - Skip saving intermediate files--generate-config - Generate default config file and exit-v, --verbose - Verbose output--benchmark - Benchmark outputWhen no mask is provided, the tool can auto-generate binary masks using:
For each processed image, the tool generates:
output/
├── textures/
│ ├── image_name.png # Front texture
│ ├── side.png # Side texture (if provided)
│ └── back.png # Back texture (if provided)
├── image_name_0.obj # 3D mesh file
├── image_name_0.mtl # Material file
When processing directories:
_mask suffix_mask in the name are automatically excluded from processingExample batch structure:
input/
├── sprite1.png
├── sprite1_mask.png # Optional custom mask
├── sprite2.png
└── character.jpg
./mimesis \
-i character.png \
-o models/ \
--extrude-height 30.0 \
--simplify-tolerance 5.0 \
--smooth-iterations 2 \
--threshold 200 \
--mask-method luminance
# Generate config template
./mimesis --generate-config -c batch_config.yaml
# Edit config file, then run
./mimesis -c batch_config.yaml -i sprites/ -o output/
./mimesis \
-i logo.png \
-o output/ \
--side-texture wood_texture.jpg \
--back-texture metal_texture.jpg
This feature allows you to run background removal on images using the RMBG-1.4 model.
RMBG-1.4.onnxExample (Windows):
set ORT_LIB_LOCATION=C:\path\to\onnxruntime.dll
Refer to this guide for details.
cargo run --features background-remover
simplify_tolerance values create simpler meshes--workers for parallel processing (TO BE IMPLEMENTED)--skip-intermediates to save disk space