Advanced VEX & Python for Houdini TDs

Taught by Jeronimo Maggi

Course Number:
Software Version:
Original Run Date:
March 2019 
2 hours 5 minutes 
This course, taught by Jeronimo Maggi, builds on the fundamentals taught in Introduction to Houdini VEX & Python (HOU217), focusing on creating a tool using mostly Python and some VEX. We start from scratch and slowly add one feature on top of the other as the needs come along, ending up learning how to debug and test our code. Throughout the course we take a look at tracking our versions with Git, using header files in VEX, creating and loading our own Python module in Houdini and creating our own digital asset to work alongside the Python module.

The project itself involves creating a digital asset to manage the animation of Alembic files. The first functionality we add is the ability to extract the animation from the Alembic file into the object level so it can be used as a very efficient collision geometry in DOPs using the object transforms. For that, we go over the logic of creating a digital asset that will be able to procedurally detect what parts are being transformed exactly the same so their transformations are extracted together.

Finally, we add the functionality of importing the extracted animation as a collision geometry inside DOPs with all the parameters configured and ready to use. By the end of the course, we will have a tool that will be able to create very efficient collision geometry for any deforming rigid object in just two clicks.
Advanced VEX & Python for Houdini TDs
Watch our overview of the course

Class Listing

Class 1: Project introduction

We look at the project as a whole and introduce the tools we will need for it. We use Sublime Text 3, setting it up to be able to highlight VEX syntax as well as compile our code with the vcc compiler and setup autocomplete for VEX functions. We cover writing our own functions in VEX and how to save this as a header file that can we can use inside Houdini by including it through pre-processor directives. Finally, we go over Git and how it works so we can use it throughout our project.

Class 2: Project, Part 1

The first step of extracting the transformations of every object is to be able to procedurally detect when an object has a different transformation than the other. In this lesson, we will create a digital asset that will compare the orientation saved in a quaternion for every connected geometry and check if any other piece has a similar value. This tool will end up creating a unique attribute value for every piece of geometry that has its own unique transformation.

Class 3: Project, Part 2

The next step in the project is to create a new digital asset that will have a callback to our script. We take a look at how to import our own Python module into Houdini using environment variables and then start developing the logic to extract the transformation from the object we select. The Python script will be responsible for creating a new node where it will automatically object merge the Alembic, create the digital asset from the previous class, and create all the outputs required to extract the transformation of each part. Along the way, we refactor the code and the digital assets to adapt to new needs as they come along.

Class 4: Project, Part 3

We finish setting up the basic behaviour of our tool to extract the animation from an Alembic file. We go over saving this in Git and merging the first working version to the master branch, before going back to developing a new feature. We add the functionality to import our separate parts as collision objects in DOPs using the object level transforms we extracted with the first step. The end result is a tool that allows us to recreate the transforms of every object at the object level, providing the possibility of adding them to DOP network as collision objects.

Class 5: Project, Part 4

We clean up the code by exposing some parameters to have the fewest number of values hard coded and then work to optimize the code and digital assets so they run as fast as possible. The Divide By Xform digital asset will get a major upgrade in its performance after updating the code to work with the new changes, and we test it with a different Alembic file to see if there are any other bugs in the code. We ill fix the final bugs and run a last test to make sure we have built a very robust, efficient, and optimized tool to extract animations.