Using Print Nodes within Material Shader Builder to Debug Houdini VOPs

Using Print Nodes within Material Shader Builder to Debug Houdini VOPs


Above is a video of what I’m about to explain.

If you’re working with VOP nodes to build a material shader builder then there’s a special procedure you have to follow to get the Print node working.

The Print node lets us send text to the Houdini console, but there’s extra steps necessary in this case because the material shader builder is ‘multi-context’.

The Print node has to know what context it is within before it can function, because of this it has to be piped through a Null node and connected to an output first (In the case I used in the video, a surface output).

Here are the instructions step by step:

  1. Make sure Houdini is run through the command line. If you are not running through the command line, then the Houdini console just will not appear (At least it will not appear on Windows). In the video above, I do this by making sure I open Houdini through a batch script that just opens my houdini executable. This way I just click on this file to open Houdini every time.
  2. Place a Null node in your material shader vop network. Pass the color output value as an input into the Null node, then just passthrough the color value back into the surface output node.
  3. Place a Print node and check the ‘Output text to console’ button, also insert a format string (using % will print out the first input).
  4. Attach a value you want to print as an input into the Print node.
  5. Attach the ‘text’ output of the Print node as an input into the Null node. This will make Houdini able to tell what context the Print node is running in since it will be connected to the surface output (through the Null node) at this point.
  6. Render your scene and you should see the Houdini console pop-up and print your Print node’s format string. (Make sure your material is attached to some geometry that is actually being rendered of course).

You can find information about this weird edge case on the Print VEX node documentation itself here: http://www.sidefx.com/docs/houdini/nodes/vop/print
Specifically the ‘Note’:

In a multi-context material network, the Print node needs to somehow be connected to a context output to work. The minimal way to do this is to connect a Null VOP into the context output node, and then connect the Print node’s output to the Null node’s second input.

As well, there seems to be an official answer from SideFX support here: https://www.sidefx.com/forum/topic/22087/

I spent 6+ hours trying to figure out a way to get some sort of information out of these VOPs to help debug something. A combination of this being a pretty narrow edge case and Houdini having a surprisingly small community makes this very difficult information to find.


Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami