Houdini Vops

From cgwiki

Houdini Vops

You might have dabbled in Houdini before, followed some tutorials, and thought 'ok, interesting, but whats the point?'. I'll tell you the point, it's Vops.

The simplest way to describe it is that it allows you to create fast multithreaded plugins to do nearly anything you want, using nodes.

Vops vs other packages

In maya, a classic case that comes up all the time is a noise deformer (ie, move every vertex on a mesh by a procedural noise function). Everyone expects it to be there, and everyone is surprised when they find it doesn't exist.

There's several solutions.

  1. Convert to soft body, write a per particle expression
  2. Write a plugin using the python API
  3. Write a plugin using the C++ API
  4. Download a plugin.

The problem is that using python or particles won't be multithreaded, so you'll hit performance bottlenecks quickly, and a plugin, unless carefully written, won't be hugely versatile. Futher, whatever work you do is specific to this context (pushing verts around), it can't be easily transferred to other geometry types or other domains of maya.

Vops, like XSI's ICE, is visual programming environment. Unlike python, it's multithreaded, unlike C++ it's easy to learn. Under the hood it uses its own compiler (vcc) to compile stuff to fast multithreaded machine code on the fly; when you're within a VOP network it recompiles each time you make a change to the network, which might incur a 0.1 second delay as it compiles. If you're outside the network, it doesn't try to recompile, and is fast fast fast.

Because of the core behavior of Houdini that 'everything is points', it means you can design a VOP network and use it on just about anything. Poly shapes, nurbs curves, particles, voxels, it doesn't matter. Further, because the geometry networks (VOPs) and shading networks (SHOPs) are so similar, you can often just copy paste your network over, and hey presto, its a shader. The only difference being that rather than operating on geometry points, its operating on micropolys, or shading points. This is a powerful thing!

It's worth pressing this point; an acronym that get thrown around for SL and VOPs (and it's underlying language VEX) is SIMD: 'Single Instruction Multiple Data'. For a render engine like renderman or mantra to run efficiently, it has to be able to shade many samples simultaneously. Because all the samples sharing a material are essentially running the same little program, SIMD structures the machine code so that a given operation (single instruction) can be run across lots of points at once (multiple data). The more CPU cores you have, the more you benefit from this.

The nice thing about VOPs/ICE/Fabric Engine is that they expose this performance for processing geometry, not just shaders, and wrap it in a nice GUI.

Simple example

In a fresh VOP network, you get a list of default input parameters and default output parameters. The defaults are normally expressed in terms of point attributes, which if you've used renderman or arnold or nuke, should be familiar. A point has a position (P), an id (ptnum), maybe a normal (N), a colour (Cd), and whatever other attributes you might have added.

So to start with, you might want to preview what a comp P-pass would look like on your geometry. You can simply connect P on the inputs to Cd on the outputs. Tada, your geometry is now coloured like a P-pass. Similarly, you could preview a normals pass by connecting N to Cd.

But that's lame. Say you want to do the noise deformer like before. Well, VOPs has a rich set of nodes to play with, including many noise generators. So you might add a turbulent noise node, set its input to be driven by P, then put down an 'add' node, add P and the noise, and finally connect that to output P.

That in itself is ok, but what's interesting is how well it scales. Feed it 100 points, or 1000 points or 100,000 points, it'll play in near realtime. That's the advantage of VOPs vs protoyping in maya and python; high performance is there right from the start.

What else can it do?

Lots. VOPs is a gui front end to VEX, which is a programming language similar to renderman's SL, which means it can do quite a lot of things. Apart from shading related things that you'd expect (noise functions, reading images, vector manipulation), it has lots of geometry processing functions (treating geometry and pointclouds, creating and deleting geometry), and common logic flow controls (if/while/for).

What's nice here is that it's such a good gateway drug into Vex. Learning a programming language can be a daunting task, but messing around with nodes is standard for most 3d artists. VOPs lets you have your cake and eat it; you can hack and slash, plug x into y, bypass something, try out this other thing, really experiment, but still get pretty remarkable performance at the end of it.

Vops vs rest of houdini

To come back to my original point, houdini was interesting but not amazing, until I found VOPs. Once I realised what it was capable of, both in terms of geometry manipulation and speed, I was hooked. A lot of beginner tutorials for houdini focus on SOPs and, lord help us, copy/stamp operations, which are messy and weird and slow. I think users coming from other packages should immediately focus on VOPs, as they really fill the hole that is lacking in Maya/Max/C4D. XSI ICE folk will feel right at home. :)

Example - transformer cube

Someone on odforce asked how to do the transformers cube, specifically a bunch of cubes that fold up on themselves and disappear. I had a stab using VOPs, was a fun thing to attempt.


Here's the post: http://forums.odforce.net/topic/20821-transformers-cubes/page-3#entry124815

I start with a cube of points (it can take any cloud of points), I tag a few moving points, and execute the following steps in VOPs. Again, the thing to keep in mind is that VOPs runs this in parallel, on all points, on as many CPU cores as you have. That's the key to it's speed.

For every point:

  1. If it's meant to be moving
  2. Find its nearest neighbour (that ideally isn't moving)
  3. Move towards it by a small amount
  4. If it's within a threshold of the neighbour
  5. Delete itself
  6. Mark the neighbour point to now move

In terms of more structured learning, there's a great thread on odforce where people are posting gradually more difficult challenges with VOPs, starting easy and progressing. Also Kim Goosens has a great bunch of tutorials on youtube.