Skip to content

Free Motion Capture for Everyone πŸ’€βœ¨

TypeScript
3.2 KB
Raw Blame
---
sidebar_position: 3
title: Blender Export
---

import { AiGeneratedBanner, Tip } from '@freemocap/skellydocs';

<AiGeneratedBanner />

# Blender Export

FreeMoCap can export processed mocap data directly to Blender, creating a complete 3D scene with skeleton mesh, camera frustums, and lighting.

:::note MediaPipe only (for now)
Blender export currently works with **MediaPipe** mocap output only β€” RTMPose 3D data does not yet have a working Blender export. See the [Post-Hoc Motion Capture guide](/docs/guides/posthoc-mocap).
:::

## Prerequisites

- **Blender** installed on your system (detected automatically or specified manually)
- A **processed recording** with mocap data (all required `.npy` files present in the recording's output data directory)
- The `freemocap_blender_addon` (installed automatically by the backend)

## Export Flow

1. **Process mocap data** β€” Run the mocap pipeline on a recording to generate `.npy` files
2. **Detect Blender** β€” The backend auto-detects installed Blender via `GET /freemocap/blender/detect`
3. **Export** β€” Click "Export to Blender" or call `POST /freemocap/blender/export`
4. **Open** β€” Optionally auto-open the `.blend` file in Blender's GUI

## What Gets Exported

The Blender addon reads the `.npy` output files and builds a complete 3D scene:

| Element | Source Data |
|---|---|
| **Skeleton mesh** | `mediapipe_body_3d_xyz.npy` β€” body keypoints connected as a skeleton |
| **Hand meshes** | `mediapipe_right_hand_3d_xyz.npy`, `mediapipe_left_hand_3d_xyz.npy` |
| **Face mesh** | `mediapipe_face_3d_xyz.npy` |
| **Center of mass** | `mediapipe_body_total_body_center_of_mass.npy` β€” whole-body COM trajectory |
| **Camera frustums** | Calibration data β€” shows where each camera was in 3D space |
| **Ground plane** | Calibration groundplane alignment β€” Z=0 reference plane |
| **Lighting** | Default three-point lighting setup |

## Technical Details

The export process runs Blender in `--background` mode:

1. Backend resolves the `.blend` output path from the recording folder
2. Injects `freemocap_blender_addon` into Blender's `sys.path` (no manual addon installation needed)
3. Runs `run_blender_export.py` via `--python`
4. The addon reads `.npy` files, builds the scene, and saves the `.blend`
5. Backend verifies the `.blend` file was created

## API Endpoints

| Endpoint | Purpose |
|---|---|
| `GET /freemocap/blender/detect` | Find installed Blender |
| `POST /freemocap/blender/addon/install` | Install addon into Blender |
| `POST /freemocap/blender/export` | Export recording to `.blend` |
| `POST /freemocap/blender/open` | Open `.blend` in Blender GUI |

## Troubleshooting

**"Blender not detected"**
β†’ Install Blender from blender.org, or specify the path manually in the UI settings.

**"Export fails β€” missing .npy files"**
β†’ Run the mocap processing pipeline first. The export readiness check verifies all required files exist.

**"Addon failed to load"**
β†’ The addon is injected at export time, not installed into Blender's user preferences. Ensure the `freemocap_blender_addon` package is available in the Python environment.

<Tip shortInfo="The freemocap_blender_addon is a separate package in the FreeMoCap GitHub org. It's installed as a git dependency alongside the main freemocap package." />