While waiting for a lengthy sub-division to finish in TopMod I remembered another project I wanted to try: HemeshGui. HemeshGui is a user interface to make 3D models with the hemesh library. You use it by starting with a simple primitive, such as a cube or icosahedron, and doing combinations of extrusions, sub-divisions, twisting, bending, and ending up with a much more complex shape. Once you are happy with the mesh you generated, you can render it using Sunflow, a global illumination ray-tracer, or export an STL file to import into another 3D program.

This blobby urchin was made with a dodecahedron, subdivided with catmullclark, extruded, then extrude-extrude three times. I twisted it around the Y axis, and applied catmullclark subdivision once more. Finally, I exported an STL file and used Sunflow to render it with smooth normals.

Install Processing

To use HemeshGui, you'll need download and install Processing. Just drag "Processing.app" to your "Applications" Folder.

Locate your Processing "Sketchbook" directory

You need to find your Processing "Sketchbook" path before adding libraries. Launch Processing, and go to the "Processing" menu, and select "Preferences". At the top of the window is the path to the folder we need. Create a new "libraries" directory in this folder. This is where the required libraries will be placed.

Install the hemesh and controlP5 libraries

Download and install the hemesh library by Frederik Vanhoutte (W:Blut). This is a mesh processing library that uses the half-edge data structure. Just download and extract it. Place the "wblut" folder in "libraries", in the "Sketchbook" directory we found above.

Download and install the controlP5 library by Andreas Schlegel in the same place.

Download HemeshGui

Download HemeshGui by Amnon Owed. I placed the HemeshGui folder in the "Sketchbook" path, but not inside the "libraries" folder.

Download SunflowAPIAPI.java and place it in the HemeshGui folder.

You'll need to tweak two files before HemeshGui works with Processsing 1.5.

Comment out the following line in SunflowAPIAPI.java by adding double slashes in front.

//package com.briansteen;

Comment out the following line in HemeshToSunflow.pde by adding double slashes in front.

//import com.briansteen.SunflowAPIAPI;

Download and Install Sunflow 0.7.3

Download the Sunflow "Sources & Binaries" file from here. Create a new folder called "code" in your HemeshGui folder. Drag the "sunflow-and-janino.jar" into the code folder.

Run HemeshGui

Double-click or drag the HemeshGui.pde to Processing, and click the arrow in the upper left corner to run it. Any errors loading will show up in red below. If you got an error, verify everything was installed correctly at the paths indicated above.

Here is a summary of where everything ended up on my computer. The "Processing" directory inside my "Documents" folder is my "Sketchbook" folder.


Using HemeshGui

The first thing I did is change the background color. In the HemeshGui.pde you can change the line below to the color you want. I just used light gray:

color bgcolor = color(230,230,230);

Begin by selecting the "Select Modifier" pop-up menu. Try "catmullclark" sub-division. This will divide larger polygons into smaller ones. Next, try 'extrude'. The slider at the top adjusts the distance of the extrusion, and the slider on the bottom adjusts what percentage of the faces will be extruded. Some of the modifiers must be run in order. For example, "extrude-extrude" can only be run after a previous "extrude".

Be careful adjusting the sudivision sliders. If you slide them too far to the right, HemeshGui may freeze for a long time. You can hit escape, or click on the stop button in Processing to quit.

Keyboard Commands

Commands that export files will save to the "output" directory in the HemeshGui folder.

  • '5' shows and hides the GUI.
  • 'l' (lower case L) exports an STL file.
  • 'z' saves a screenshot.
  • 'x' does a sunflow preview render.
  • 'c' does a high quality sunflow render.

References and Inspiration

Tags: hemesh, hemeshgui, sunflow, processing, generative, 3D, tutorial