Getting started

Help!

Often the hardest thing is getting started. So I’m going to try and lay out plain and simple how I started and where to look for things. The goal for this post is to provide you with as much information on how to compile your first VRAYprocedural. You might already know a lot of this info as it can be found in the documentation or scattered on the forums, but let’s start easy and expand from there. Talking about documentation, Sidefx has added some pretty decent documentation online and you will be browsing through them often (bookmark!): General Houdini documentation and HDK specific documentation. There is also a bunch of good info on the odforce wiki.

On a side note, if you are “afraid” of programming/scripting/mathematics/goldfish :) /… there really is no reason for that. You just need to inform yourself better and “get over it” or “just do it”. So to help inform you there are plenty of resources out there, courses, video tutorials and books. Here is a list of some of the books that have helped me along the way of becoming a better TD: Technical Director books on Amazon

Next up: Operating Systems!

I am not too fond of windows, so I am using Linux, specifically Ubuntu 9.04. I have never compiled a houdini plugin for windows, so I won’t be sharing any info at the moment on how to do that. The majority of the code I’ll be writing should work for windows too. I’ll see if I can include that information in a later post, or you can look on odforce wiki under the HDK section.

General configuration.

Some of the tools or packages/libraries are assumed to be installed by houdini.

You will need the build-essentials:

sudo apt-get install build-essentials

and the cshell:

sudo apt-get install csh

And the same gcc compiler as the version of houdini you are running, if you don’t know which gcc you have installed you can find out with:

ls -l /usr/bin/gcc

And it is probably a good idea to check which gcc versions you have installed:

ls /usr/bin/gcc*
aptitude search gcc

This will show you a list with all versions of gcc in the repositories and if it is listed with an “i” it is installed.
example (check with your houdini version):

sudo apt-get install gcc-4.3

If you have several versions of gcc installed you can modify the gcc symbolic link to point to whatever version you need it to be and restore it afterwards – you can also specify it with by exporting the CC variable which can be picked up by the “make” utility.

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.3 /usr/bin/gcc

Finish your compile, then restore the original symlink (if you need to):

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-4.1 /usr/bin/gcc

or:

export CC=/usr/bin/gcc-4.3

Houdini configuration.

So where is everything? The houdini install directory is a good place to start looking. Houdini is often installed under: /opt/hfs11.x.xxx
I have a symbolic link in there that points to the latest version of houdini, this is really convenient because when updating to a new build of houdini you just need to change that symbolic link and everything else will still point to that link.

cd /opt
sudo ln -s /opt/hfs11.0.504 /opt/hfs11

Make sure it is installed properly and that you are sourcing the setup script. For example, in my .bashrc file I have added the following lines (be careful not to modify anything else as this can have a big impact on your linux shell):

gedit $HOME/.bashrc
#setup houdini variables etc.
alias h11='cd /opt/hfs11;source houdini_setup_bash;cd'
h11

When you open a new shell you should have your houdini environment initialized. So let’s go take a look inside the install directory:

cd $HFS
ls

Explore!

Under the /opt/hfs11/bin folder you can find all the programs that come with houdini. Ever used gplay, hkey, hbatch, hrender, mplay, mantra, hcustom,…? It’s a good to know there are a bunch of extra programs that come with houdini that you can run from the command line without ever having to open houdini. Some might consume a render or batch license though.

Under the /opt/hfs11/toolkit folder you will find:
include
makefiles
samples

include

The include folder contains all the header files, which provides you access to almost all functionality of Houdini (this is the treasure chamber :) ). It’s a bit of a maze at first and depending on your houdini knowledge you might find functionality faster as often the functions in the header files are named the same as the tools in houdini. The online HDK help can help you search through it. But sometimes it is faster to grep what you are looking for:

cd $HFS/toolkit/include
grep -r polygon . 

or to look for any examples that contain the “polygon” keyword:

cd $HFS/toolkit/samples
grep -r polygon . 

The above will look recursively in the current folder for the keyword “polygon”. After a while you will start to see some of the more important classes drift to the surface. I’ll go more in depth on some of these in a later post.

makefiles

The makefiles folder contains templates of makefiles. A makefile is a file that helps with the compilation of your plugin and is being used by the make utility (as part of linux). There is a lot of info online already on make files and this can get quite extensive. For now we can ignore them and instead use hcustom to compile a plugin. hcustom is one of those convenient little helper programs that ships with houdini, you can find it in the $HFS/bin folder.

samples

The samples folder contains a bunch of example files. Most types of node have an example. It’s a good idea to copy this directory to your own development folder.

mkdir $HOME/dev/houdini11.0
cp -R $HFS/toolkit/samples $HOME/dev/houdini11.0

So from here one we can go and start compiling.