Difference between revisions of "Houdini Vops"
|Line 26:||Line 26:|
=== Simple example ===
=== Simple example ===
Revision as of 22:41, 25 September 2014
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.
- Convert to soft body, write a per particle expression
- Write a plugin using the python API
- Write a plugin using the C++ API
- 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.
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.
Demo file here: File:vopsop_example.hipnc
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.
The pointcount overlay doesn't appear in this screengrab, but I go from 6,468 points, to 82,500, to 316,932, and Houdini smoothly degrades in performance. The lag as I increase the point count is from the upstream nodes calculating the new geometry; once that's done the vopsop performs quickly and smoothly.
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 as a pointcloud, creating and deleting geometry), and common logic flow controls (if/while/for).
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.
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:
- If it's meant to be moving
- Find its nearest neighbour (that ideally isn't moving)
- Move towards it by a small amount
- If it's within a threshold of the neighbour
- Delete itself
- Mark the neighbour point to now move
If you crack open the scene you'll see there's a few things that differ from a vanilla vopsop. First, its using a 'solver' sop at the top level, this gives you an easy way to access the results of the previous frame. In this case my setup can easily calculate a delta for motion, calculating an absolute position would be a little harder. With a solver, I can just calculate that delta, and add it to the P of the previous frame.
Also, I use a AttribVop rather than a vopsop. Had to ask the houdini guys at work what the difference is. A VopSop is the original old style vop node, it lets you modify points, but that's it. An AttribVop is the newer sibling, it does all that a vopsop does, but also lets you do things like create and delete geometry. Because I need to delete the points as the system evolves, its my node of choice.
There's a great thread on odforce where people are posting gradually more difficult challenges with VOPs, starting easy and progressing. Kim Goosens also has a great bunch of tutorials on youtube.