Motion Capture Data Parsing
Python + Houdini
Introduction
Motion capture is a technique widely used in animation and visual effects. The raw data came from motion capture devices are usually in a format that 3D software doesn't recognize. This exercise will convert the raw data into a readable .txt sequence, and load it into 3D software Houdini.
This is the third exercise of Prof. Deborah R. Fowler's VSFX 705 - Programming Concept class in Spring 2013.
Get the data, manipulate its formatMotion capture data comes in the format of a list, which contains position information of all the markers in a frame-by-frame basis.
Since the data itself couldn't be access by 3D software, so a reformatting operation must be conducted before loading them. In this case, Python being very handy with string manipulation.
|
May 11th, 2013
|
The motion capture data used here are came from Motion Capture Lab of the Advanced Computing Center for the Arts and Design, Ohio State University.
|
|
Import the Motion Capture Data into Houdini
import hou geo = hou.pwd().geometry() # source file directory source_file = hou.evalParm("mocapFiles") source_file = hou.expandString(source_file) # open the file file = open(source_file) poly = geo.createPolygon() poly.setIsClosed(0) # read in the mocap file for line in file: line = line.split()[1:] # split the list, leaving the x,y,z point datas only points = geo.createPoint() # create a point points.setPosition((float(line[0]), float(line[2]), float(line[1]))) # position the points based on the mocap's x,y,z # close the file file.close() |
The parsed motion capture data was then imported into Houdini, via a python operator that reads in .txt sequence and shows the data as particle cloud in the 3D scene.
A basic sphere geometry was attached to the point cloud to represent the tracking markers, and series of nodes such as Scatter, Pointjitter and Trail were connected to enhance the sphere body's volume.
|
Rendering, Compositing and Post-Processing
Finished Animation
Raw Render
|
Compositing Breakdown
|
Spheres are connected to a mantra shader with basic reflection, and another shader with self-illumination is given to the marker's position.
The scene is rendered using Houdini's Physical Based Lighting with a skylight setup. The rendered sequence is then composited in After Effects.
|
Reference
- Resources for Python from Professor Deborah R. Fowler's Website
- Python Quick Reference from Professor Malcolm Kesson's Website
- How To Think Like a Computer Scientist from Open Book Project
- Python Basic Tutorial from Tutorialspoint
- A Python Course from Uta Priss
- Motion Capture Lab from Advanced Computing Center of the Arts and Design, The Ohio State University