# OptiTrack Blender Plugin

## Overview <a href="#overview" id="overview"></a>

The [OptiTrack Blender Plugin](https://optitrack.com/support/downloads/plugins.html) enables streaming of real-time Rigid Body data from Motive to Blender.&#x20;

{% embed url="<https://youtu.be/jolxdj_VoxI>" %}

### Version Requirements <a href="#version-requirements" id="version-requirements"></a>

* Blender Version: 4.1 or above (recommended)
* Motive Version: 3.1.0 or higher

## Blender Setup (Client) <a href="#blender-setup-client" id="blender-setup-client"></a>

To install the plugin:

* Download the Blender Plugin from the [OptiTrack downloads](https://optitrack.com/support/downloads/plugins.html) site.&#x20;
* DO NOT unzip the downloaded file.&#x20;

### Import Plugin Package into Blender <a href="#import-plugin-package-in-blender" id="import-plugin-package-in-blender"></a>

* In Blender, select *Preferences* from the Edit menu.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/3f9ErpGXsCGabliDGLRr/image.png" alt=""><figcaption><p>The Edit menu in Blender.</p></figcaption></figure>

* Select *Add-ons* from the menu on the left.
* Use the dropdown arrow in the upper right corner to select *Install from Disk...*
* Browse to the downloaded zip file and *Install from Disk*.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/qSywKzbdvoXpjj0JFdOG/image.png" alt="" width="495"><figcaption><p>Blender Preferences: Add-ons.</p></figcaption></figure>

### Enable the Plugin <a href="#enabling-the-plugin" id="enabling-the-plugin"></a>

* Click in the Search bar at the top of the Preferences pane and search for *Motive*.
* Search will return the Motive Blender Plugin. Check the checkbox to enable it.&#x20;

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/qk0l81gNRAOhM8BSx6lU/image.png" alt=""><figcaption><p>Enabling the Motive Blender Plugin from the Blender Preferences pane.</p></figcaption></figure>

* Once the plugin is successfully enabled, it appears as a tab in the Sidebar.

{% hint style="info" %}
If the Sidebar is not visible, click the small arrow (highlighted, below) in the upper right corner of the 3D Viewport, or use the hotkey "N" to toggle it open or closed.
{% endhint %}

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/f6pHgxomzh2dpMQ5sQNm/image.png" alt=""><figcaption><p>Blender 3D Viewport with the Sidebar collapsed. </p></figcaption></figure>

## Motive Data Streaming Setup (Server) <a href="#motive-data-streaming-setup-server" id="motive-data-streaming-setup-server"></a>

Start by configuring the data streaming settings in Motive. Once configured and enabled, Motive broadcasts tracking data to the designated network interface where client applications can receive it.

The OptiTrack Blender Plugin is designed to configure the necessary streaming settings automatically. This section covers the Motive settings needed for the Plugin to work effectively.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/vdBEI4TCC0cDboRpgov0/image.png" alt="" width="491"><figcaption><p>Motive Application Settings: Streaming Pane. <br>Recommended settings for streaming to Blender.</p></figcaption></figure>

Click the <img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/zWIjDiIP0rAgyQ9ieCvZ/Control%20Deck%20-%20Streaming%20Off%20SMALL.png" alt="" data-size="line"> button in the right corner of the Control Deck to open the [Data Streaming Pane](https://docs.optitrack.com/motive-ui-panes/settings/settings-streaming) in Motive’s [Application Settings](https://docs.optitrack.com/motive-ui-panes/settings) window. Configure the following settings:

* **Enable** - Toggle this setting on to enable streaming in Motive.
* **Local Interface** - This is the Local Host IP address. Motive is the Server and Blender is the client.&#x20;
  * When running Motive and Blender on the same machine, select loopback. This sets the IP address for both Server and Client to 127.0.0.1.
  * When streaming to a different PC, select the IP address that connects the Motive (server) computer to the network where the Blender (client) computer is located.&#x20;
* **Transmission type** - Set to *Multicast*. The Blender Plugin is currently unable to use Unicast.
* **Rigid Bodies**- Enable *Rigid Bodies*.
* **Skeleton coordinates** - Set to Global.
* **Bone Naming Convention** - Set to *FBX*.
* **Up Axis** - Set to *Y-Axis*. The plugin automatically converts the Up-Axis to the Z-axis.
* **Remote Trigger** - Keep this setting disabled.

Once these settings are configured correctly, prepare your live Motive session or a *Take* to get ready to stream data into Blender.

{% hint style="warning" %}
Blender 1.0.0 only supports Rigid Body data.
{% endhint %}

## Blender Plugin Connection Setup

The Blender Plugin panel includes a Properties section for assigning assets.&#x20;

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/C9og9cUwxVZlCRP4YUlL/image.png" alt=""><figcaption><p>The Motive Plugin Panel in Blender.</p></figcaption></figure>

### Apply Motive Streaming Data to Objects

#### Assign the Server IP and Client IP

* Server IP: enter the IP address for the Motive PC.
* Client IP: enter the IP address for the Blender PC.
* Enter 127.0.0.1 in both fields when Motive and Blender are running on the same computer.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/ldJsAj8dv4zhTjeWeK2w/image.png" alt=""><figcaption><p>IP settings.</p></figcaption></figure>

#### Set Transmission Type

The Motive Blender plugin works in Multicast only. Make sure that Multicast is set in both Blender and Motive, as [noted above](#motive-data-streaming-setup-server). &#x20;

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/LE2BS96XN7ySP6bR8qpF/image.png" alt=""><figcaption><p>Transmission settings.</p></figcaption></figure>

#### Update Blender Configuration (optional)

As needed, Blender settings can be changed in the plugin panel for the following settings:

* Unit System
* Unit Scale
* Frame Rate

Once changes are made, click the *Apply Configuration* checkbox to override Blender's settings with those selected. Deselect the checkbox to revert settings back to Blender's default.&#x20;

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/wHiHQJPto8aavKaghLUI/image.png" alt=""><figcaption><p>Configuration settings.</p></figcaption></figure>

#### Start Connection

Select *Start Connection* to obtain the data stream from Motive.&#x20;

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/g0JOiFwjISXXwGtVk8GW/image.png" alt=""><figcaption><p>Connection options - not connected.</p></figcaption></figure>

When connected, the Connection settings will display the assets streaming from Motive. Assets will be labeled by *Streaming ID: Asset Name.*

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/fceqzzkn2SbXP2Zm5vtk/image.png" alt=""><figcaption><p>Connection options - while connected.</p></figcaption></figure>

* Use the *Refresh Assets* button to update the asset data after switching *Takes* in Motive.&#x20;
* Click *Stop Connection* to stop streaming data entirely.

### Assign Assets - Rigid Bodies <a href="#assigning-assets-rigid-bodies" id="assigning-assets-rigid-bodies"></a>

* Open the *Object Properties* for the 3D Mesh you wish to link to the Rigid Body.
* In the *Motive: Assign Assets* section, select the Rigid Body that you want to track with the mesh from the Cube dropdown list.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/ws8pyBzlmU4ALnouEIfk/image.png" alt=""><figcaption><p>3D Mesh properties: Motive: Assign Assets.</p></figcaption></figure>

* In the Motive plugin panel, select *Start Receiver.* The 3D Mesh will start ingesting the Rigid Body data directly from Motive.
* Use the Pause button to stop the data from streaming into the object, and the data will stop being written to the 3D mesh.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/tzoStnsqu1DgVEQD2Ej2/image.png" alt=""><figcaption><p>Motive Rigid Body data streaming into Blender.<br>Click image to enlarge.</p></figcaption></figure>

## Using the Recorder

The Recorder function of the plugin allows you to plot keyframes on the tracked object in Blender's timeline. Keyframes will plot on the Location and Rotation Transform values of the object's properties.&#x20;

{% hint style="info" %}
Rotation values are plotted in Quaternion angles. Data can still be modified in post-processing in Blender using the rotation gizmo, which uses Euler angles.
{% endhint %}

### Recording <a href="#recording" id="recording"></a>

* Click the *Start Record* button <img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/EqtP8TcIqnbJZkbKdlNH/image.png" alt="" data-size="original"> to begin recording.
* Keyframes will begin moving forward and plotting on the timeline.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/RSyv73XYRGyVoHuw0odY/image.png" alt=""><figcaption><p>Blender timeline with plotted keyframes.</p></figcaption></figure>

* Click the *Stop* button <img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/iuNHSePj8RKWGgJujcji/image.png" alt="" data-size="original"> to stop plotting the key frames.

### Record a Frame Range <a href="#recording-a-frame-range" id="recording-a-frame-range"></a>

Use the *Record a Frame Range* function when data needs to be recorded within a set time limit.&#x20;

* Check the box to toggle on the *Record Frame Range* function. <img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/ooYJJ6pxVw7kKFIchV94/image.png" alt="" data-size="original">
* Click *Select Frame Range,* input the desired start and end frames to record within, and click OK.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/9GxAHCs83qt97hELetHU/image.png" alt=""><figcaption><p>Select Frame Range to record in Blender.</p></figcaption></figure>

* Whenever this option is toggled on, Blender will record the data only within the selected Frame Range when recording is in progress.&#x20;
* Uncheck the box to toggle the *Record Frame Range* function off.&#x20;

### Record Multiple Actions <a href="#recording-multiple-actions" id="recording-multiple-actions"></a>

The *Create New Action* function allows you to record multiple actions in one Blender session. This function swaps the current action and keyframes in the timeline with a new action containing no keyframes. To start recording in the new timeline, click *Start Record*.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/IT6q4ToiGe5tF8iPJJr4/image.png" alt=""><figcaption><p>The Create New Action button.</p></figcaption></figure>

### Managing Actions with Dope Sheet

The Dope Sheet Action Editor shows all of the Actions in the file.&#x20;

* Select the dropdown clock icon in the upper left of the Timeline window.&#x20;
* Select *Dope Sheet* from the popup menu.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/ccZmNPJimPqNPJ3u6Qh9/image.png" alt=""><figcaption><p>Access the Dope Sheet in Blender.</p></figcaption></figure>

* In the *Mode* dropdown, select *Action Editor*.

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/zcwKWv9hIwibnjEnjsDi/image.png" alt=""><figcaption><p>Dope Sheet Mode selection.</p></figcaption></figure>

* Use the dropdown list in the upper middle of the Action Editor window to create and edit multiple actions within the same Blender session. If you would like to create new actions this way, click the ![](https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/McNljXmnYb6nAWoxgxf4/image.png) button.&#x20;

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/P04ZhO7OWZQKaODCYydU/image.png" alt=""><figcaption><p>Available Actions in a Blender session.</p></figcaption></figure>

{% hint style="danger" %}

* The preferred method for making new actions is to use the “Create New Action” button in the plugin’s panel rather than creating them through the Action Editor.&#x20;
  {% endhint %}

When moving to the next action, Click the *Delete Action* button to remove all the key frames from the previous recorded action.&#x20;

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/lwiT5BcIZ927T3IPporw/Delete%20Action%20buttons.png" alt=""><figcaption><p>Delete Actions in Blender.</p></figcaption></figure>

## Access Help <a href="#note-for-maryanne-knight" id="note-for-maryanne-knight"></a>

The *Info* section of the plugin includes linked buttons to access the OptiTrack website and the Blender documentation in our online user guide (coming in release 1.1). &#x20;

<figure><img src="https://content.gitbook.com/content/GaZwzcsVav6zPBRZpapU/blobs/zlsjSjBwoLAOyrgboFaR/image.png" alt=""><figcaption><p>The Info Panel in the <br>Motive Blender plugin.</p></figcaption></figure>
