Creating Geometry From Scratch

file Banner.png
Click here to get to find a link to the Guided Houdini Files.

 

start9.PNG
Start from the previous lesson and keep the ground, sun, sky and camera nodes.

Here we explain how to generate geometry procedurally. There are two node types that allow tho do this: Nodes of type Attribute Wrangle allow to specify geometry using the programming language VEX. Nodes of type Python allow to do the same in the Python language. In general you should keep in mind the following: Quite often the same task implemented in VEX leads to a much better performance than the corresponding implementation in python. The reason is that VEX is compiled on the fly in such a way as to exploit all available possibilities for parallelization. On the other hand, Python offers a wealth of numerical libraries. This means that many tasks have to be done in Python, but the standard choice should be VEX.

VEX Code Geometry
tet-cone-simple
A geometry created inside the code of a node.

For example we already showed several times a cone over the one-skeleton of a tetrahedron. To create this geometry in Houdini on can use an Attribute Wrangle node and paste into the text field labeled “VEXpression” the following code:

32.gif
Creating an attribude node and making it run once.
make pretty.PNG
You should also use the previously learned methods to make the geometry look good.

Here you also see how to define custom functions in VEX. For a general introduction to VEX we refer to the documentation. The same task could also be accomplished with a Python node. The necessary Python code looks as follows:

Interactive Parameters
wheel-11
Resulting geometry of the next code.

It is also possible to add interactive parameters to nodes. As an example we create a wheel with a variable number of spokes: Create a node of type Attribute Wrangle. Add a parameter of type float named numSpokes with label “number of spokes” to the node (see the documentation for the details how to do this). The needed VEX code is the following:

34.gif
Adding a new wrangler.
35.gif
New code and interactive parameter.
36.gif
The result when playing with the slider. The materials appear in the render view, this is the scene view.
37.gif
Changing the interactive parameter with the slider. Up and down.

And never forget, if you are ever in need of a vex function that you try to find it in here http://www.sidefx.com/docs/houdini/vex/functions/_index.

written by Pinkall/Padilla 2016/17

Print Friendly, PDF & Email