Deborah R. Fowler
VSFX 705 - Python,
Data Parsing and Houdini
Posted pdf for VSFX 705 Spring
2013
Updated on July 9 2024
In this class you will be required to write a script to parse at least one txt file from the sample data given and then use a python script (given below) inside of Houdini to read the files you have generated and create a visual.
NOTE: The files that have been supplied consist of a single txt file which contain marker data per frame. These files have been adjusted to 24fps already unlike the data files in the previous versions of this exercise.
Goals:
This assignment will focus on the student becoming familiar with python, data parsing and most importantly, using python in Houdini. The goal is to take a motion capture txt file, which contains point positions (x,y,z) of motion capture markers and use python to separate the data and write a new sequence of files to be used in Houdini.
NOTE: This is an exercise in scripting and an introduction to houdini - it is possible to bring in mocap data more easily by importing an fbx, however the purpose of this exercise is to become familiar with python.
If you wish to take this exercise further there are two pages with information - one to explore Houdini, the other to explore Unreal
Requirements:
- Given a motion capture data file in txt format, your
python script will parse this file and write a new set of
files to be used in Houdini. This file script will prepare
the data for Houdini.
- It will convert the given single txt motion capture file (supplied) to a series of files (you create) to be read into Houdini.
- An example of the python script that may be used inside Houdini to read in these files is given below in the screen snap. You must be able to clearly describe the code you create during presentation and comment it. The script to parse the single file into multiple files must be your own creation.
- With this data, create a visual result in Houdini.
- You will be submitting your file creation script before the
final due date (consult the google calendar)
Sample data here
The sample data accessible above has a header listing the Frame number and marker label (point data) for all markers on the body (in our case 53, but you do not need to rely on this number). Below is a partial screen snap of the data supplied.
test.txt
From this data you will create single frames of point data to be read into Houdini from a script.
HINT: You can pick off point data (three numbers in a row, excluding the Frame number at the start) by using a clever mod expression or use the slice operator.
Most students use the slice operator by either taking the 3 items just written off the list, or by indexing properly into the list.
HINT: If you do not recall what slice does type in the following:
If you are having problems WRITE AN ALGORITHM. Test by breaking it down into pieces - work modularly. For example you could
- try it on a single line of source (testOneLine.txt),
read the data in and print it so that 3 numbers are printed on
each line ("\n" is a newline character)
- try creating code that opens a file, writes "Hello" and then closes the file
- now try combining the two ideas
To bring it into Houdini, simply use a python node inside a geometry container: Hit TAB and type python to get a python node.
( A similar process was used in Spring 2013. Please ignore as we are NOT using a Digital Asset and all relevant resources are contained in the current description on this page.)
The script given below assumes your data looks as follows (adjust accordingly if you change it). NOTE the correspondence of the source file to ONE of the lines in out.001.txt highlighted in yellow.
HINT: Creating a user defined control for the file name can be created using the parameter interface as can be seen
- on your dailies
snowman exercise video or
- on this powerpoint
The project will be submitted to your dropbox in a folder (also called a directory) named:
F24_V705_E4_LastnameFirstname_Title/
The directory should contain the following:
- F24_V705_E4_LastnameFirstname_File.py
- F24_V705_E4_LastnameFirstname.pdf or html
- F24_V705_E4_LastnameFirstname.jpg (or png) - a beauty shot
- F24_V705_E4_LastnameFirstname.mov (or mp4) - compressed H264 -
you may want to use handbrake
- F24_V705_E4_LastnameFirstname.hipnc
- your source txt file
- DO NOT HAND IN ALL THE TXT files. I will run your python script to produce those files
- DO NOT HAND IN CACHE FILES
Remember to test/view your files before handing them in! Be sure
to comment your code!
Grading:
Clean efficient code and a cool visual are the emphasis.
Meeting the minimum specifications, 80%. To move your grade
above 80% go beyond the specifications, demonstrate exploration
and understanding.
*Although you have been provided with examples, you are NOT TO
HAND IN THE CODE GIVEN IN THE EXAMPLES. YOU ARE TO CREATE YOUR OWN
SCRIPT FOR PARSING. This must be properly commented and understood
by you – the examples are only for reference. Handing in the exact
code will result in a grade of zero. However you are allowed to
use the code given in the screensnap above for the Houdini
portion. Please comment it accordingly and feel free to change it
for your purposes.
If you would like a challenge see the section on fun with markers
or the section below, but only after you have the above working.
Be creative, have fun.
History:
This assignment was inspired by Malcolm Kesson at http://www.fundza.com/python/mocap_parsing/index.html
For inspiration, there are excellent examples of this process on Professor Malcolm Kesson’s 705 website. In this case, they have used data from the Ohio State University's Motion Capture Lab of the Advanced Computing Center. If you decide to take on the additional challenge of parsing the txt format supplied on the OSU's site be aware the format is not the same nor is the frame rate.
It may be helpful to look at two student versions of parsing the Ohio State data:
Nate Usiak
Sorya Sorei for Maya
Challenge:
You are not required to use the Ohio State Data. This would be considered an added challenge.
If you do want to do the extra work, data in ascii txt format can be found at https://accad.osu.edu/research/motion-lab/system-data Thanks to the Motion Capture Lab of the Advanced Computing Center for the Arts and Design, Ohio State University.