# Recipe G — Image → 3D asset

# Recipe G — Image → 3D asset

**Outcome:** A printable `.glb` mesh file generated from a 2D reference
image, which is itself generated from a text prompt. Useful for product
mockups, mini-print figurines, AR previews.

**Approx cost:** ~$0.12 per asset.

## Script

```bash
#!/bin/bash
set -euo pipefail

PROMPT="${1:-a low-poly fox figurine}"

# 1. Reference image — single object on a clean background
REF_IMG=$(visa-cli generate image \
    "$PROMPT, single object centered on pure white background, 1:1, no shadow" \
    --json --yes \
    | jq -r '.urls[0] // .filePath')

# 2. 3D mesh seeded from the reference image
MESH=$(visa-cli generate 3d "$REF_IMG" \
    --json --yes \
    | jq -r '.urls[0] // .filePath')

echo "Reference image: $REF_IMG"
echo "Printable mesh:  $MESH"
```

## Cost breakdown

| Step | Tool | Approx |
|---|---|---|
| Reference image | `fal-flux-pro` | $0.04 |
| 3D mesh | `fal-trellis-3d` | $0.08 |
| **Total** | | **~$0.12** |

## Variations

- **Multi-view pipeline** — generate 3-4 reference images at different
  angles, pick the best, then feed to 3D.
- **Control the style upstream** — bake the look (`"voxel"`, `"realistic"`,
  `"stylized low-poly"`) into the image prompt in step 1; the mesh follows
  the reference image.
- **For physical printing** — pipe `$MESH` through a slicer (Cura,
  PrusaSlicer) outside this recipe.
