Course Notes

Posted on Feb 22  2020

Updated on March 17  2024


Quick Links
Intro to Programming
Python Resources
Houdini Resources


Due Dates
Submission Guidelines
Expectations


E1 - Quilt
E2 - Hurricane
E3 - Random Art
E4 - Houdini Script


Additional Examples


copyright © Deborah R. Fowler

VSFX 160 Exercise

Deborah R. Fowler



VSFX 160 - Python, Data Parsing and Houdini

Posted pdf for VSFX 705 Spring 2013
Updated on Dec 17 2024

MISSING GIF


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: Considerations:

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
EXTRA HINTS: http://deborahrfowler.com/PythonResources/ProgrammingIntroClass14.html

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.


MISSING IMAGE

HINT: Creating a user defined control for the file name can be created using the parameter interface as can be seen


Submission guidelines:

The project will be submitted to your dropbox in a folder (also called a directory) named:

W25_V160_E4_LastnameFirstname_Title/

The directory should contain the following:

Remember to test/view your files before handing them in! Be sure to comment your code!

Grading: (rubric posted on exercise table)

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. Consider using color, filled shapes, and so on – but first get the basic assignment working.

*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. Please comment it accordingly and feel free to change it for your purposes.

If you would like a challenge please see 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.