Difference between revisions of "Unreal Engine: Skeleton Streaming"

(Notes on bone mapping)
(2. Setup the Blueprint)
 
Line 59: Line 59:
  
 
[[Image:UE4_BlueprintSetup_Animation.png|center|550px]]
 
[[Image:UE4_BlueprintSetup_Animation.png|center|550px]]
 +
 +
{{Info|'''Bone Transformation'''
 +
 +
Within the animation blueprint, you can utilize other blueprint utility tools from UE4 to modify the streamed data. For example, Transform (Modify) Bone nodes can be included after the OptiTrack Skeleton node to apply a transform to specific skeleton bones as needed. Please refer to [https://docs.unrealengine.com/en-US/BlueprintAPI/index.html Unreal Engine documentation] for more information on using animation blueprints.
 +
}}
  
 
{{Info|'''Roll Bone Interpolation'''
 
{{Info|'''Roll Bone Interpolation'''

Latest revision as of 13:14, 14 February 2020

Main PageMotive DocumentationOptiTrack Unreal Engine 4 PluginUnreal Engine: Skeleton Streaming

Page Scope

This page provides instructions on how to set up skeleton streaming using the Unreal Engine plugin. Please note that this feature is supported for plugin version 4.19 or above only.

Skeleton Bone Mapping[edit]


Info2.png

Skeleton streaming is supported only in plugin versions 1.9 or above.

Tutorial Video[edit]

Setup[edit]

Follow the below steps to set up skeleton streaming onto Unreal Engine.

1. Create a Animation Blueprint in the 3D View[edit]

Step 1. Navigate to a character folder. With Paragon sample characters, it is located in Characters → Heros → [Character Name] → Meshes.

Step 2. Right-click the blank space in the Content Browser pane, then select Animation → Animation Blueprint.

Step 3. On the pop-up window, select the OptiTrackAnimInstance at the parent class section at the top and click on the target skeleton name at the bottom. Then click OK.

Step 4. In the content browser, assign a name to the created animation blueprint.

Step 4. Drag the character blueprint into the scene.

Step 5. Select the character blueprint in the 3D View

  • In the Details Pane, select “+ Add Component” and create a new an “OptiTrack Skeleton Component” on the model.
  • Set the “Source Skeleton Asset” equal to the skeleton name in Motive.
  • Adding animation blueprint in UE.
  • Specifying skeleton name under OptiTrack Skeleton Component properties.
  • Creating animation blueprint.


2. Setup the Blueprint[edit]

Step 1.Double-click the animation blueprint in the content browser to open its editor.

Step 2.Right-click the animation graph, then create a new "OptiTrack Skeleton".

Step 3.Right-click the animation graph, then create a new "Get Streaming Client Origin" and connect its output to the Streaming Client Origin.

Step 4.Right-click the animation graph, then create a new "Get Source Skeleton Asset Name" and connect its output to the Source Skeleton Asset Name.

Step 5. Right-click the animation graph, then create a new "Component To Local" and connect the output from "OptiTrack Skeleton" into its input.

Step 5.Connect all of the nodes together. The basic animation flow chart should look like the following.

UE4 BlueprintSetup Animation.png

Info2.png

Bone Transformation

Within the animation blueprint, you can utilize other blueprint utility tools from UE4 to modify the streamed data. For example, Transform (Modify) Bone nodes can be included after the OptiTrack Skeleton node to apply a transform to specific skeleton bones as needed. Please refer to Unreal Engine documentation for more information on using animation blueprints.

Info2.png

Roll Bone Interpolation

For characters with unmapped shoulder roll bones, the skeleton plugin will detect its existence and apply a slight twist to the roll bones to keep smooth swinging motion on the arms. In the OptiTrack Skeleton blueprint, you can enable/disable this feature from the Roll Bone Interpolation checkbox, and you can also adjust how much of twist is applied by setting the Roll Bone Blending parameter. When this parameter is set to 0, the plugin will not adjust the roll bone motion, and when this is set to 1, the plugin will attempt to adjust its motion to keep the shoulder steady on the character.

Please note that this feature may not work on some characters.

Skeleton with the roll bone interpolation (left) and without (right)

3. Assign Bone Mapping[edit]

Step 1. Select the OptiTrack Skeleton plugin in the blueprint graph area.

Step 2. Drop down the Bone Mappings property in the Details Pane.

Step 3. Click “Auto Fill Bone Mapping” to automatically assign the bones in the skeleton to the OptiTrack skeleton names.

Note: There is no standard for bone naming conventions, so bone names may vary depending on characters. After doing the auto-fill, review the list and double-check that the auto-assigned names are correct. You may need to manually use the drop-down menu to adjust the assigned mapping for missing, or incorrect, items.

Step 4. Hit "Compile" in the top left to build the blueprint.

Auto-mapped skeleton bones.

4. Setup OptiTrack Streaming[edit]

Step 1. Open the 3D View

Step 2. Search OptiTrack Client Origin in the Modes pane.

Step 3. Drag the OptiTrack Client Origin into the 3D scene, then select it to access its properties.

  • (Optional) put it at 0,0,0 location.
  • Make sure that streaming settings on both Motive and Unreal match.

See: OptiTrack Unreal Engine page for more instructions on setting up the client origin.


5. Click Play[edit]

Notes on bone mapping[edit]


The OptiTrack Unreal Engine Skeleton Plugin uses bone mapping, not retargeting. This means that the bone segments in Motive map directly to the character model (bone mapping), instead of being translated into something that is usable by a more abstract biped model (retargeting). Because of this non-anatomical skeletons will not map correctly without some additional tweaking.

Practically, this means that you will need to do things like turn off the toe mapping for characters with high heels, adjusting the pelvis bone in Motive or in the model for characters with non-anatomical hip bones, and not use bipeds that are too anatomically different than humans, such as a gorilla or swamp monster.

For example, the character sample below has both a non-anatomical pelvis and high heels. It is preferable to use character models that are more anatomically correct, but in this case, you can do a couple things to mitigate these issues:

1. Turn-off toe streaming[edit]

In the example below, since this character is wearing heels, any actor providing data for this model will also need to be wearing heels. To get around this you can just turn off the toe mapping in the OptiTrack Unreal Engine Skeleton Plugin.

UE4 Toe1.png UE4 Toe2.png

2, Adjust the bone segments in Motive[edit]

The hip segment on the Countess actor is centered in the stomach rather than in the pelvis, the neck bone in Motive is a bit too long for the model, and the shoulders in Motive do not match the width of the character’s shoulders. By adjusting bones' positions and lengths in Motive, you can make the streamed skeleton to better match the model; however, please note that there are limitations to how much you can do this.)

  • UE4 Bone1.png
  • UE4 Bone2.png

Bone Scaling[edit]

When streaming skeleton data to animate characters that have different bone lengths compared to the mocap actor, the UE character will need to be scaled accordingly. In this case, the "Scale Bones" feature in the OptiTrack Skeleton node automatically scales the character bones to match the mocap actor. This setting is enabled by default.

UE4 Skeleton Scaling.png

Aligning Bones[edit]

The OptiTrack Unreal Engine Skeleton Plugin uses bone mapping, not retargeting. This means that the bone segments in Motive map directly to the character model (bone mapping), instead of being translated into something that is usable by a more abstract biped model (retargeting). Because of this, non-anatomical skeletons will not map correctly without some additional tweaking. Starting from plugin version 1.23, you can tweak the alignment of the bone mapping by adding sockets to the skeleton blueprint:

Adding Sockets to the Bone Mapping[edit]

  1. Open Skeleton Editor of the character you wish to modify
  2. Under the skeleton tree, right-click on the bone that you wish to add the sockets to.
  3. In the context menu, click Add Socket.
  4. Go to the Animation blueprint, and change the bone mapping of the bone which you have created sockets for, and map it to the socket that was just created.
  5. Play the scene, and adjust the socket location from the Skeleton Editor to adjust alignment of the bone.
  • Creating a socket for the right hand in skeleton editor.
  • Skeleton Editor: Socket created
  • Animation Blueprint: Mapping the right hand to the created socket.
  • Translating the right-hand socket in the skeleton editor.