Using RenderMan from Houdini

Disclaimer: These were written for Houdini 2.5. While they are still relevant for some more recent versions, they don't take into account SHOPs, and hence you may need to improvise a little

You're just getting to grips with Houdini when someone sugguests you look at using Renderman. Perhaps you just want to speed up rendering, or maybe you've got some shaders that you want to use. In my case I was specifically interested in RenderMan before I even touched Houdini, but getting the two packages working together for the first time is far harder than you might expect.

As I've explained elsewhere RenderMan is an interface, and not a particular renderer. In principle it's therefore possible to to use BRMT, the ART Renderdrive or any other compatable renderer. However these currently require even more hoops to be jumped through, so we're going to only consider Pixars implementation - "PRMan". 9 times out of 10, when someone says RenderMan they mean PRMan, so lets start talking about PRMan with Houdini...

Why Bother?

Mantra works fine, and I've just warned you (or perhaps you've found out for yourself) that learning Renderman with Houdini is a pain. Besides, a commercial license of PRMan costs almost as much as Houdini so whats the payoff?

Firstly speed - PRMan is fast. Just for quick tests, prman is about twice the speed of Mantra, and for industrial grade rendering its just about the only choice. It's also

flexable
allowing custom code to be hooked into the renderer in the form of shaders,
portable
running on a range of hardware
interoperable
being accessable from practically all major animation packages
open
its operation is exceeedingly well documented.

Setting up PRman

OK - enough rhetoric. First thing to do is set up prman. All that requires is the addition of one or two directories to your path. In your home directory is a file called ".cshrc". Edit it using "Jot" (or better yet "vi" - learning vi is an investment worth making, as you can use it inside Houdini). You need to add the following line:

set path = ($path /usr/local/prman/bin /usr/local/rat/bin)

Once you've done that, save the file, and open a new shell window (by the way - I'm assuming youre on a Unix box with a C-shell here). If you type "render" and you don't get the message "command not found" then you're in buisiness.

You've also set up the path for "alfred" - more of that later. You may not have alfred, as its part of Renderman Artist Tools (rat) which are really aimed at Maya, but if its available you can use it from Houdini for network rendering. Type "alfred" to see if it works...

Your First Render

Now it's time to start Houdini (from a shell window in which "render" is working). Create a basic scene, then select "view rman" from the render icon under the viewport. You should get an "it" window apearing, with a preview of your work, rendered in PRMan!

Following the excitment of your first PRMan render, you'll probably find that the image is a little dull. Thats because by default Houdini assigns the "plastic" shader to all objects. The first step in getting something which looks decent is to select the shading tab of each object in the object editor, and set its surface shader to be empty.

Having done this, if you render again, you should find that your Materials created in Houdini have been applied in PRMan. This is handy, as it allows you to use the Materials editor to produce basic textures while having the power of renderman shaders available if you need them.

Importing Shaders

In addition to Houdini generated materials you can use Renderman specific shaders. These have the extension "slo", and a whole bunch of standard ones come with PRMan. To use one just click on the "+" at the end of the surface shader box on the shading panel. This gives you a list of shaders which you can simply select, and attatch to your object. You'll also find a text field for Displacement Shader on the shading tab. Digging a little deeper you'll also find options to attatch renderman shaders in the parameter panels for lights and atmospheres.

You're now well on the way to being able to drive renderman from Houdini, but there's one trick you still need to learn - how to load new shaders into Houdini. Unfortunatly this is not as easy as you might hope, and requires two stages - one using the shell, and the other using the (dreaded) textport.

Firstly we need to tell Houdini about the shader, by creating a dialouge panel for it. This is done using the command /usr/hfs/bin/rmands (RenderMAN Dialouge Script). The required parameters to this are somewhat complex, but fortunatly if you simply run it, it gives an example which is almost exactly as required. cd to the directory containding your shaders, and run the commend given in the example, minus the *.via on the end (as you probably don't have any of these). To make things a little more complex for beginners, the first time you run it you'll get an error message about not being able to create a file. That's because the directory doesn't exist. Use mkdir to create the directories its refering to, and try again.

If you restart Houdini you'll find that the new shaders are available in the dialouge panel, along with editors for their parameters (note that some parametes such as colour still come from the material editor, so you'll still need to create Materials as place holders).

You can now attatch the shaders, but when you try and render you'll find that they cannot be found by PRMan (check the window you started Houdini from for error messages). To tell PRMan where to find your shaders you need to open a text port and enter the following:

set RMAN_SHADERPATH = "$Job/Shaders:\
$HOME/whereeverIKeepMyShaders:\
/usr/hfs/houdini_ri_shaders:&"

This can be entered all on one line, by removing the backslashes. You should then be able to render using the shaders from your home directory. You can also set this in the output driver in later versions of Houdini.

Final Renders

To produce final output, simply add an output driver for renderman, much as you would with Mantra. If you have Alfred you can then add an Alfred output driver, and point it to use a previously setup RenderMan ouput. You'll find that shaders do not get automatically generated from Materials. To get round this you need to export the shaders source from the Materials editor, compile it, and then expicitly attatch the prman shader produced. You can also get into problems if you've started up alfred seperatly from Houdini, rather than Houdini start the dispatcher. See the Houdin startup page for a way to get round this.

Conclusion

That's it! You're now ready to start using Renderman within Houdini. There are other tricks you can learn, for example using the rest position of objects within shaders, and controlling the mapping or Houdini parameters to shader variables (see the Attribute SOP). You'll find more hints, and pointers elsewhere on these pages, but now its time for you to start flying on your own.

Ian Stephenson.
DCT Systems
NCCA, Bournemouth University