Python & RMS
Repurposing MoCap Data

return to main index


The tutorial, Python: Parsing MoCap Data, presented two python classes (MoCapMarker and MoCapDB) that can read and store mocap data. This tutorial presents a super class of MoCapDB, called MoCapRMan, that uses the mocap coordinate data read by the base class to generate rib archives containing RenderMan RiPoint, RiCurves and RiBlobby geometry. Examples of the geometry created by instances of the MoCapRMan class are shown below. The data files used for the illustrations was obtained from the website of the Advanced Computing Center for the Arts and Design, Ohio State University,

Figure 1
343 fields (frames) - one RiPoint per mocap marker.

Figure 2
41 RiCurves - one curve per marker each with 343 cvs.

Figure 3
One RiBlobby - one blob per marker per frame (14063 blobs).

When used with an approriate interface with Maya the primitives generated by MoCapRMan can easily be animated - figure 4. The .rman and .mel scripts that create a GUI for use with MoCapRMan is given later in this tutorial.

Figure 4
Animation with a 'trail' of 15 frames.

Figure 5
Animation with a 'trail' of 160 frames.

Figure 5
Animation of a RiBlobby rendered volumetrically.

Standalone Testing of the MoCapRMan Class

The code for the MoCapRMan class can be found here - In addition to using MoCapDB, MoCapRMan also uses The steps shown below outline the easiest way to test the scripts.

Step 1

The following scripts,, and should be saved in the same directory, for example,

Step 2

Download and unzip a sample TXT mocap data file from,
and save the file in the same directory as the python scripts.

Step 3

Make a directory named 'RIB_Archive' in the 'mocap_test' directory. MoCapRMan will expect to save the rib archive files it creates in the 'RIB_Archive' folder.

Step 4

Save the following python script in the 'mocap_test' directory as ''.

from MoCapRMan import MoCapRMan
scale = 0.01
# The following path and name of the mocap TXT will require editing.
datapath = '/Users/jdoe/Documents/mocap_test/handspring.txt'
spread = 1
steps = 1
pnt_width = 0.3
cache = 'Compute'
mo = MoCapRMan('anyname', datapath, scale)
rib = mo.writePoints(spread,steps,pnt_width,cache)
print rib

Open in Cutter and choose control+e, alt+e or Apple+e to execute the file. Cutter's Process Monitor window will echo the path to the rib archive file created by 'mo'.
If the archive file contains data then you have confirmed the scripts are working correctly.

Step 5

The following rib file can be used to render the archive.

Display "untitled" "it" "rgba"
Format 640 360 1
Projection "perspective" "fov" 20
ShadingRate 1
Translate  0 0 100
Rotate -30 1 0 0
Rotate 0   0 1 0
Scale 1 1 -1
    ReadArchive "PATH_TO_ARCHIVE"

MoCapRMan, Maya & RMS

The easiest way to use MoCapRMan with Maya is to create an artist-friendly user interface. This section of the tutorial demonstrates how an interface for use by Pixar's RenderMan Studio (RMS) can be added to Maya - figure 6.

Figure 6, and should be moved to the directory from which the users custom python scripts are sourced by Maya. The interface is implemented by the following scripts.
      mocapUI.mel, and
They should be saved in the directory from which users custom mel scripts are sourced by RMS and Maya. Suggestions about the directory structure to store custom scripts for use with RMS and Maya can be found in the following tutorial,
      RMS: Customizing

Maya Workflow

1.   Create a proxy object, for example, a poly cube.
2.   Select the proxy and run this mel command,
3.   Toggle the transform and shape tabs of the proxy to display the interface.
4.   Select the mocap data file and render the scene.
5.   When using "Trail" with a value greater than 1,
      switch "Render Settings->Frame/Anim Ext" to name.#.ext.

To use another data file frame zero must be rendered. New instance of MoCapRMan are always created when frame zero is rendered.

© 2002- Malcolm Kesson. All rights reserved.