Custom mesh visualization with Houdini

Preview in new tab(opens in a new tab)

Houdini is not the typical software used for scientific visualizations but the possibilities that Houdini offers are truly amazing.

However the first step to use Houdini is to instruct it how to read data. In this guide I’ll describe the steps to read an element mesh. I assume that the mesh data file is in some custom format.

One option is  to convert the custom file into a typical file format like wavefront .obj and then read via a file node.

The option I’ll describe here is to use a python node that reads a custom mesh file. The format of the file is as follows

where np is the number of mesh nodes and nel the number of mesh elements. The next np lines are the coordinates of the nodes followed by the node ids that the elements are made of. Note that the file reads either triangular or quadrilateral elements. The triangular elements are indicated by setting 0 as the fourth id of the node element.

By default Houdini interface is split into 3 main windows. Place the cursor anywhere inside the network view window(bottom right), press tab, start typing the word geometry, press enter to confirm and left click to place a geometry node.

Hou_001 Hou_002

Double click to enter inside the geo1 node. Select the default file node and press delete to… delete it!

Inside the geo1 node, with the cursor still located anywhere inside the network view, press tab, type python and press enter to confirm and left click to place the python node. The window above the network view is where the properties of the selected node are shown. For the python node there is just an almost empty area where one can write python code. I’ll add one more property which is a gui element to select the mesh file.

Find the gear button at the top right corner of the property window. Click once and choose Edit Parameter Interface…

Hou_004

At the left panel select the type file and click the arrow between the 2 panels (the one that points to the right) to add a new parameter.

Hou_005

Highlight the newly created property and rename the Name and label as shown in the figure below

Hou_006

Make sure you spell the Name exactly the same way

Next Apply and Accept to close the window and a new property will appear!

Hou_007

You can now click on the icon after the dropdown menu symbol to chose the mesh file.

Finally paste the following code inside the python Code area and you should be able to read a 2D mesh.

My example is a 2D mesh for the Central Valley groundwater basin

Hou_008

While this doesn’t seem to be something particularly interesting, it’s basic step for using the Houdini Beast!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.