Starting Houdini

This may sound like a crazy subject for a tutorial, but there's far more to starting Houdini than just typing houdini in a shell window. Things get a little compilcated if you want to use RenderMan (perhaps both prman and bmrt), if you also use a few other packages, and particularly if you use bourne shell (supprisingly the generally clued up side fx guys seem to be the only hackers in the world who LIKE c-shell!).

Though my prefered software is of course Houdini and PRman, I have to work with and suppport users on a wide range of packages. To keep my setup as flexable as possible I put as little as possible into startup files, and have scripts to start the major tools we use (I'm only documenting the Houdini scripts here, but I have similar scripts for SoftImage, Maya, and a load of other stuff). This ensures that the config for one app can never clash with the config for another.

To start off in my .profile I setup PRman and BMRT - these are both clean setups, and are used by all the other apps, so it makes sense to do that work here:

PATH=/usr/local/rat/bin:/usr/local/prman/bin:/usr/local/BMRT2.4/bin:$HOME/bin:$PATH
export PATH
SHADERS=$HOME/RenderMan/Shaders
export SHADERS
This sets up my path to include all of the renderman and BMRT bin directories (you might have them elsewhere), and my own home directory bin. SHADERS is set up to point where I keep my renderman shaders (and copies of all the standard ones) - this is required by BMRT. If you don't have a $HOME/bin or a shaders directory you probably want to make one now.

If you use C-shell then put the following in your .cshrc instead:

set path = (/usr/local/rat/bin /usr/local/prman/bin /usr/local/BMRT2.4/bin $HOME/bin $path)
set SHADERS = ( $HOME/RenderMan/Shaders )

OK thats my standard shell steup - its clean, so when we start doing the setup for a particular app there's very little to cause any problems. Now we can start on Houdini. Create a text file in $HOME/bin called goHoudini (don't try and be smart by calling it houdini - it doesn't work), and make it executable. It should contain the following code:

PATH=$HOME/bin/BMRTShader:$PATH
export PATH

csh <<!
setenv SESI_LMHOST @origin1

cd /usr/hfs
source $HOME/bin/.houdini_setup
cd

houdini
!
Firstly this adds a new directory BMRTShader to the path - this contains commands that we only want Houdini to see. We then start a c-shell, which houdini requires, set up the license server (origin1 in my case), source the setup script, and then we can finally run Houdini.

You'll notice that I've copied houdini_setup to $HOME/bin/.houdini_setup. This allows it to be edited - if you're sysadmin, then you could edit the original, other wise make the copy. We'll discuss what we need to change in a moment.

If you wish to use BMRT in houdini, then we need to fool Houdini into compiling shaders with slc. If you just use bmrt you can use a link. However I use prman primarily, so I want Houdini to compile shaders for BOTH renderers. I do this with another shell script called $HOME/bin/BMRTshader/shader. This is the extra directory which gets added in when we start Houdini, so that the trick is only played on Houdini. The script contains:

FILE=`echo $* | sed 's/\ -q\ / /g' | sed 's/-nolint/ /g'`
slc $FILE
/usr/local/prman/bin/shader -q -nolint $FILE
The first line strips out some switches that Houdini includes occasionally, but confuse BMRT. I put them back explicitly when I run shader in the third line.

To use BMRT you'll also need to copy the shaders from /usr/hfs/houdini/ri_shaders to $HOME/RenderMan/Shaders (again, sysadmins can do this in place) and compile them for BMRT (or compile for both and you can have one less entry in your RMAN_SHADERPATH). I copy almost everything (including the standard shaders) to my Shaders directory, and compile them with both compilers. If you only use BMRT them you need bmands to generate dialogue scripts. If you use both renderers then just use rmands. You can now render to BMRT by simply adding a renderman output driver with the command:"rendrib -d 16"

There's one final twist to this startup strategy - alfred. Alfred works a lot better from Houdin 3 than it did in 2.5, but to get started we need one more twist to the step scripts. If you do an alfred render from Houdini, then Houdini starts Alfred, so Alfred inherits the environment, and things work OK. However if you're started alfred already from a command line then it won't have the necessary setup so it fails with some very unhelpfull error messages. After much hair tearing (don't worry I've plenty left!) the problem is that Alfred can't find hscript. We can fix this by adding a script called hscript in $HOME/bin:

#!/bin/csh
setenv SESI_LMHOST @origin1
HERE=`pwd`

cd /usr/hfs
source $HOME/bin/.houdini_setup

cd $HERE
exec /usr/hfs/bin/hscript $*
This sets up the environment on the fly. However we're still not there yet, as houdini_setup prints out that stupid "The Houdini environment..." message which really confuses alfred renders. Hence we need to edit the houdini_setup file and delete the line "echo The Houdini...".

Once thats done you should be able to start Houdini with goHoudini, render in both prman and BMRT, and send jobs to Alfed. I told you there was more to this startup business than you thought! I'm sure that most users don't need anything so complicated, but hopefully there are a few tricks in here that you find usefull.

Ian Stephenson.
DCT Systems
NCCA, Bournemouth University