HDK
|
After you install Houdini, the HDK can be found at $HFS/toolkit. Inside the toolkit directory, you will find the following folders:
Folder | Contents |
include | The C++ header files which give you access to Houdini's comprehensive set of libraries. |
makefiles | A collection of Makefiles intended to be used as building blocks for your HDK project's Makefiles. For more details, see Compiling with Makefiles. |
samples | A extensive set of HDK code examples. Several HDK samples are referenced throughout the documentation. For example, the standalone/geoisosurface.C link refers to the code sample located at $HFS/toolkit/samples/standalone/geoisosurface.C. |
You need to determine which compiler built the version of Houdini that you are using. On Linux, Houdini is built with the GNU compiler (gcc). The gcc version is embedded in the build's filename (i.e. houdini-X.Y.ZZZ-linux-x86_64-gcc6.3.tar.gz). It is not always required, though recommended, to build your HDK projects with the exact gcc version. For example, if Houdini is built with gcc 4.4 and you are using gcc 4.3, chances are your compiled HDK code will work perfectly with Houdini. However, if Houdini is built with gcc 4.4 and your HDK tools with gcc 3.4, then you may run into problems. You should check the GNU website to see which gcc versions are compatible and which are not.
On Linux, you will also need some development packages installed in your distribution. Unfortunately, the package names differ depending on the particular Linux distribution.
For Debian-based distributions, try using:
For Red Hat-based distributions, try using:
On Windows, you need Visual Studio to compile the plugins (download from Microsoft). It is vital that you compile your HDK code using the same compiler version that built Houdini. One can determine by looking at the suffix of the installer file. Here is a quick list of the available Houdini Windows versions and which compiler is used to build each one:
Suffix | Compiler |
vc142 | Microsoft Visual C++ 2019, version 16.9.4 |
Note that you will also need to set the MSVCDir environment variable to point to the VC subdirectory of where you have it installed.
To develop on Mac OSX, you will need to install XCode from the Mac App Store.
Houdini is built with the Apple clang compiler. Similar to gcc on Linux, it is not always required, though recommended, to build your HDK projects with the exact clang version.
The sample code standalone/geoisosurface.C is a very simple stand-alone program which can be used as an introduction to the HDK.
The program, in brief, is:
When executed, this simple program generates an ISO surface and saves it to a Houdini geometry file named sphere.bgeo.
To build the program, use hcustom, a tool designed to conveniently build the HDK samples and small custom projects.
On Linux, first open a shell and set it up for using Houdini and the HDK by typing:
After it is set up, copy the geoisosurface HDK sample into a writable place.
Now you can build geoisosurface by typing:
On Mac OSX, use Finder to navigate to the Applications folder. Then open the Houdini X.Y.ZZZ folder (substitute X.Y.ZZZ with your particular version) and double click on Houdini Shell.terminal to start the Houdini command-line shell.
In the Houdini shell, copy the geoisosurface HDK sample into a writable place.
Now you can build geoisosurface by typing:
On Windows, choose Start > All Programs > Side Effects Software > Houdini X.Y.ZZZ > Command Line Tools (substitute X.Y.ZZZ with your particular version).
In the Command Line Tools window, copy the geoisosurface HDK sample into a writable place:
Now you can build geoisosurface by typing:
hcustom creates an application, geoisosurface, in the current directory. Run geoisosurface to generate sphere.bgeo which you can view in Houdini's gplay application. For example:
And that's it! You have just built and ran your first HDK application!
geoisosurface.C connects to Houdini's geometry utility library by including the GU_Detail.h HDK header. The header file can be found in $HFS/toolkit/includes/GU.
The GU_Detail::polyIsoSurface() method evaluates the callback function densityFunction()
inside the bounding box specified by bounds
. A mesh of polygons is created and saved to sphere.bgeo.
Try experimenting by changing the implementation of densityFunction()
and see what kind of surfaces you can create. For more information on creating geometry using the HDK, see the Houdini Geometry section.