Importing Rokoko Character Animations into Xcode Using Blender


This article extends upon the Mixamo characters article. It assumes you already have a character in Xcode and want to add custom animations beyond those provided by Mixamo. In particular, I wanted to explore how animations could be captured using Rokoko’s motion capture solution. Rokoko offers both a suit-based option and a free camera-based solution (with a licence fee for the dual-camera edition). As with the Mixamo workflow, the exported DAE files need cleanup before Xcode will accept them — xcode-collada handles this automatically.

Workflow

To make a captured animation compatible with a character previously rigged using Mixamo, both the Mixamo character and the Rokoko animation need to be brought into Blender for retargeting.

One-Time Setup

  1. Export your Mixamo-rigged character in a t-pose
  2. Import the character into Blender. An official guide can be found here, with this video tutorial

For Each Animation

  1. Capture an animation using Rokoko Vision
  2. Export as an FBX file
  3. Import the FBX into Blender alongside your character and retarget
  4. Export the retargeted animation from Blender as a DAE file
  5. Clean up the DAE file using xcode-collada
  6. Import into Xcode

Below are solutions to some of the common problems you may encounter along the way.

Rokoko Camera Capture

When using Rokoko’s camera-based capture, it uses the macOS continuity feature to activate both the built-in webcam and a connected iPhone. In Safari this worked without configuration, but the video was strangely cropped.

Chrome fixes the cropping issue, but getting both cameras to work simultaneously takes some effort. The Rokoko Vision documentation recommends opening Photo Booth, switching to the iPhone camera, and then refreshing the Rokoko Vision page. You should also check that Chrome has permission to access both cameras:

Chrome camera permissions

Both your laptop and phone cameras should be listed. If not, I found that juggling between QuickTime, Safari and Chrome eventually got them to appear.

Blender Plugin Issues

As described in Rokoko’s Blender retargeting guide, several plugins are required:

The latter two both failed to install on Blender 4.1.

Fixing the Mixamo Plugin

Someone has already resolved this. As noted in this forum post, you need to unzip the plugin and make two changes.

Update the top of version.py:

import bpy

class ARP_blender_version:
    _string = bpy.app.version_string
    blender_v = bpy.app.version
    _float = blender_v[0]*100+blender_v[1]+blender_v[2]*0.01

blender_version = ARP_blender_version()

Update armature.py:

import bpy

def restore_armature_layers(layers_select):
    armature = bpy.context.active_object.data

    if not isinstance(armature, bpy.types.Armature):
        return

    for bone, hide_status in zip(armature.bones, layers_select):
        bone.hide = hide_status

def enable_all_armature_layers():
    armature = bpy.context.active_object.data

    if not isinstance(armature, bpy.types.Armature):
        return []

    layers_select = []

    for bone in armature.bones:
        layers_select.append(bone.hide)
        bone.hide = False

    return layers_select

Credit to the author who discusses these changes in this video. Rezip the files and reinstall in Blender.

Fixing the CATS Plugin

Someone has already published a fix. You can download their version from the unofficial CATS GitHub page. Zip the files and install in Blender as usual.

Importing and Exporting in Blender

When importing the Rokoko FBX file into Blender, ensure the animation and armature options are configured correctly:

Blender FBX import options

After importing, you should see the Mixamo bone hierarchy in the scene outliner. This is the structure that the retargeting process maps onto:

Blender bone hierarchy

When exporting the retargeted animation as a DAE file, pay attention to the export settings. On the Main tab, enable “Selection Only” so only the animation is exported:

Blender Collada export — Main tab

On the Geom tab, leave the defaults:

Blender Collada export — Geom tab

On the Anim tab, ensure “Include Animations” and “Include all Actions” are checked:

Blender Collada export — Anim tab

Once exported, run the file through xcode-collada to fix the prefixed bone names, extra nodes, and nested animation tags that Blender introduces. You can then import the cleaned file into Xcode and load animations following the instructions in the Mixamo article.