June 7th, 2011

Master’s Project — Dev Log

The first three terms of my Master’s course are done and only the final dissertation is left to do. My topic is about the creation of an FRep Modeller in Houdini using the Houdini Development Kit (HDK). This post will be be used as a personal log, documenting key decisions, progress and solutions to problems encountered on the way to completion.

I officially started work on the June, 7th. Read the whole article to find out more.

June 7

  • First day. Aim is to compile some sample code on my MacBook Pro running Mac OS X 10.6 and Houdini 11 Apprentice.

  • Starting point, official HDK documentation.

  • Trying to run first example according to the documentation, but hcustom could not be found. On the Mac, the framework is located under /Library/Frameworks/Houdini.framework (later referred to as $HFS). To setup the environment, “$HFS/Versions/Current/Resources/houdini_setup or you can launch the terminal by running Houdini Shell.terminal in the Application directory.”

  • Another solution is to add the following to ~/.bash_profile:

    export PATH=/Library/Frameworks/Houdini.framework/Versions/Current/Resources/bin:$PATH export HFS=/Library/Frameworks/Houdini.framework/Resources

  • If compilation gives an error like shown below, try fixing the permissions of Houdini.framework or copy it elsewhere:

    Error: Making standalone.o from standalone.C /var/folders/sK/sKOIH98OF3ya7Hyggyrz1++++TI/-Tmp-//cc6Mgk9W.s:unknown:FATAL:can’t create output file: standalone.o Compile failed

  • I copied the toolkit folder from $HFS to a local directory and was now able to compile a sample (-s flag is for standalone): > hcustom -s samples/SOP/SOP_Star.C

  • On the Mac, this created a dylib in ~/Library/Preferences/houdini/11.0/dso.

June 8

  • Found a Mac Makefile, not in use yet since I’m using hcustom to get the basic samples working.

  • Could not compile standalone programs which seems to be a common problem, however, got my first SOP sample running:

First HDK sample running: Custom star SOP

June 9

  • Got the star sample compiling using my own Makefile which had to be placed in the samples/SOP. It includes both the Makefile.mac I found yesterday and the Makefile.gnu:

DSONAME = SOP_Star.dylib
SOURCES = SOP_Star.C
INSTDIR = /Users/andy/Library/Preferences/houdini/11.0
include ../../makefiles/Makefile.mac
include ../../makefiles/Makefile.gnu

  • Next, look at some more samples.

June 10

June 11

Color Falloff Example: Python custom SOP * Got basic inline C++ example working, no problems. Cool!

June 14 & 15

  • Spent some time trying to build the samples from within Xcode or QtCreator. Unfortunately, that is quite tricky with all the linker settings. However, I can still use these IDEs and by including the header files, syntax highlighting and auto-completion work as well.

  • The remaining time was spent on reading more about FReps and the Houdini Geometry in the HDK.

July 4

Haven’t updated this in a bit. Last 2 weeks where mainly about sorting out administrative issues and sitting down with Denis who explained me his FRep API. I also read “Writing Solid Code” by Steve Maguire, a great book on developing bug-free C programs.

Running hcustom from within QtCreator

Finally, figured out a way to run hcustom from within QtCreator. One way is to echo the commands run by the command via hcustom -e which gives something like this:

g++ -DUT_DSO_TAGINFO=’”3262..826″‘ -DVERSION=\”11.0.775\” -D_GNU_SOURCE -DMBSD -DMBSD_COCOA -DMBSD_INTEL -arch x86_64 -DAMD64 -fPIC -DSIZEOF_VOID_P=8 -DSESI_LITTLE_ENDIAN -DENABLE_THREADS -DUSE_PTHREADS -D_REENTRANT -D_FILE_OFFSET_BITS=64 -c -DGCC4 -DGCC3 -Wno-deprecated -DNEED_SPECIALIZATION_STORAGE -I/Library/Frameworks/Houdini.framework/Resources/toolkit/include -I/Library/Frameworks/Houdini.framework/Resources/toolkit/include/htools -Wall -W -Wno-parentheses -Wno-sign-compare -Wno-reorder -Wno-uninitialized -Wunused -Wno-unused-parameter -O2 -DMAKING_DSO -o SOP_Star.o SOP_Star.C

g++ -bundle SOP_Star.o -arch x86_64 -fobjc-gc-only -framework OpenGL -framework Cocoa -rpath,@loader_path/Libraries -Wl,-rpath,/Library/Frameworks/Houdini.framework/Versions/11.0.775/Libraries -L/Library/Frameworks/Houdini.framework/Versions/11.0.775/Libraries -F/Library/Frameworks/Houdini.framework/Resources/Frameworks -framework Houdini -o /Users/andy/Library/Preferences/houdini/11.0/dso/SOP_Star.dylib

This can then be forwarded to QtCreator as a custom build step. Alternatively, the call to hcustom itself can be defined as a build step, as shown below.

Custom build step for hcustom For this to work however, the variable $HFS has to be defined and the directory containing hcustom and hcompile has to be added to the PATH variable.

Build Environment

July 17

The last 2 weeks were mainly spent adapting the underlying FRep API to make it GCC compatible. We finally got it running and I can now start connecting it with my previous Houdini code.

Also, Make files were adjusted to be able to use them inside QtCreator. The workflow is now down to 2 steps, compiling the dylib in QtCreator and launching Houdini via the terminal (to get console messages).

July 18

Mid-term crit today, talked with Ian and Jon about some architectural issues. Unfortunately, Houdini’s built-in Sphere, Box, … nodes are not directly extendable, only SOP_Node is.

Compiling the FRep library together with my HDK nodes now finally works. Had a problem with Houdini not being able to load the library (dyld: Library not loaded: libQtRep.1.dylib, Reason: image not found). This could be resolved by setting the path variable before running Houdini via terminal:

export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/andy/Dropbox/BU/MastersProject/Source/terra4/QtRep

July 20

Some very good progress over the last couple days (and nights). The workflow is now set up, so a simple compile plus (re-)opening Houdini does the trick. Create three nodes so far:

  • FRep_Node: The base class for the other FRep classes. At the moment, this is at the same time used for polygonization and to output the mesh.

  • FRep_Box: An FRep box, controlled via its center and bounds attributes

  • FRep_Sphere: An FRep sphere, controlled via its center and radius attributes

Basic Nodes and Polygonizer

July 25

Very productive week.

  • Setup bzr repository. Needed to adjust the python version for it to run on Mac OS X Lion. Also, configured SSH to use a master connection so it doesn’t ask for a password for every bzr command.

  • Checked in the the QtFrep project to compile the FRep lib with gcc as well as the current basic houdini-lib.

  • Added dropdown list to CSG node. Also, improvements to the recursive traversal algorithm that now also understands Houdini’s transform node.

Csg Operations

  • Started with the thesis. Further tweaks in the LaTeX template. Abstract is based on project proposal. Most of the chapters are defined.

July 27

  • Again, very good progress over the last 2 days. Had a problem providing the normals, but the people ad odforce gave me a good hint, so we can now geometric and analytic normals from the polygoniser fed into the system.

  • Improved the traversal algorithm in the main FRep node to now support Houdini’s built-in torus, box and sphere node. This way, they can be used to model and the corresponding FRep entities get created on the fly upon traversal. This helps keep the network simple and also allows us to use the guide geometry and controls.

Using Houdini box and Sphere

August 1

  • Meeting with Turlif yesterday discussing many things, interesting uses and usability issues amongst them. Prepared a demo file displaying the currently implemented primitives and operations. Currently supported:
    • Primitives:
      • Sphere
      • Box
      • Tube (Cylinder)
      • Cone
      • Cone
    • Blending:
      • CSG
      • Blend
      • Bounded Blend
    • Others:
      • Metamorphosis
      • Twist
      • Taper
      • Deform Point (missing guide geometry)
      • Bend

Samples of supported Primitives and Operations

Twist Node example

Bend Node example

  • Modelled a Penguin. Still very simple, but can also be used to do some cool metamorphosis :)

FRep Penguin

August 11

Lots of updates. The thesis is complete for the most part, only parts of conclusions/future work and results (mostly screenshots) left.

The Sphere Sweep node now works, so does the offset node. The last node to implement is the instancer. A lot of time went to trying to support sharp features for polygonising. It seems to work in standalone, but not Houdini. Very strange.

Sphere Sweep Node

Offset Node



Leave a Reply