Houdini Fundamentals – Points, Vertices and Primitives

As I’ve mentioned before these blogs are coming either from my notes or my deep seated need to understand and remember things I’m unsure of. This very much the latter. Though I’ve used these things many times to do some complex tasks I’ve never really sat down and thought about them. Time to put that right.

At the heart of Houdini – indeed every 3D software package – is the polygon. In 3D modelling a polygon is defined by its vertices (points in space), commonly three or four vertices are used to make a polygon that is either a triangle or a quad. These make sense to use as the basic building block of any shape because they are planar (flat).

They are also known as faces. A collection of faces positioned correctly creates a mesh which models any shape in your 3D world.

So how does Houdini deal with these fundamental objects? Well, it uses three things: points, vertices and primitives. Makes sense to me if we define those first.

  1. Points – a point is simply a position in 3D space, with 0,0,0 being the origin.
  2. Vertices – a vertex is a reference to a point. We’ll come to this in a moment as the difference between points and vertices is where most of my confusion arises.
  3. Primitives – a primitive is a polygon created by the vertices. Actually there are many types of primitive in Houdini and what we’re talking about here is the polygon primitive

To explain how these are put together I’ve created a very simple node network in Houdini. It’s simply a square grid with one division across the middle. In addition I’ve turned the point numbering on – shown below circled in red.

A grid shown with points turned on.

Now something that’s very handy in Houdini is the Geometry Spreadsheet. I’m going to split my left hand pane top to bottom and in the bottom section change Scene View to Geometry Spreadsheet. I’ve made sure it’s displaying points (again circled in red) and moved the divider down to give my scene more space.

Geometry Spreadsheet pane

So what can we see here? Our grid is made from 6 numbered points 0-5. If we look in the Geometry Spreadsheet we see that each has a position defined in 3D space, x, y and z. As the grid is centred on the origin and the grid is 4×4 in size the points tend to be defined by 2 or -2 in the x and z plane. What of y? Well, in Houdini y is up by default and our grid is flat.

Next I’ll turn on Primitive numbering in our display. You can see them here added in purple. The switch for this is outlined in red.

Primitive numbering turned on

As you can see, our grid object is actually made of two primitives 0-1. If you think about it this makes sense. The polygon primitive is planar. If we were to lift points 2 and 3 upwards the new shape would be something like a tent and definitely not planar. It would require two primitives and that’s what it has.

A superbly detailed tent created from two primitives

I’ve turned our shape back into a grid and turned vertex numbering on. You’ll very rarely need to see vertex numbers so the option to do that is hidden away in the display options (circled in red). In addition I’m now looking at Vertices in the Geometry Spreadsheet (more red).

Vertices take centre stage

What we can see here is that each primitive is made of four vertices 0-3 and each is near a point (in actuality they’re in the exact position of the point but Houdini kindly offsets them a little to let we humans see things clearly.) We can see that vertex 2 in primitive 0 and vertex 1 in primitive 1 are both at point 3.

So why bother with both points and vertices? This is the source of my own confusion in this area and the road to clarity lays within the following: a point can belong to any number of primitives (here point 3 belongs to both primitives) but a vertex belongs to a single primitive. This is essential because it allows us to keep both primitives planar whilst retaining the ability to edit the points to change the shape.

Here I’ve moved point 3 upwards and you can see the vertices have moved along with it and now we have a sort of bivouac rather than a tent. Remember, a vertex is just a reference to a point, it has no position of it’s own. If you look in the Geometry Spreadsheet you can see this clearly. Vertex 2 in primitive 0 (shown as 0:2) is referencing point 3, as is vertex 1:1.

A bivouac

Now you may say to me that neither primitive is actually planar and you’d be quite right. A quad doesn’t have to be flat in any particular plane but the thing about any quad is that they can be split diagonally to create two triangles and triangles are always planar.

To punctuate the difference between points and vertices I’m going to use the Facet node to make each point unique to a vertex. Unfortunately Houdini overlays point numbers in the same position so what we have here is point 3 and our new point 6 covering each other, as shown in red.

If I now move point 3 back down you’ll see our bivouac get a bit broken. This is because each vertex is now referencing a single unique point which effectively breaks the connection between our two primitives.

Broken Bivvy

As you can see, vertex 0:1 references point 6 and 1:2 references point 3. This would not be possible if we just had points and primitives.

Now while we’re here we’ll have a very quick look at normals, in particular vertex normals. Both points and primitives can also have normals which may be used for many tasks but what we’re looking at here is the ability to use vertex normals to smooth the edge between primitives. In some software packages you’ll see this called Smoothing or Smoothing Groups.

But wait, what is a normal? It’s simply an imaginary line that sticks out from a vertex perpendicular to it’s plane. A imaginary line can be called a vector, in this instance a 3D vector, which is defined by two positions in 3D space. So a normal is a directional vector that starts at the centre of our vertex and points somewhere.

For this I’ve gone back to our bivouac and added a Normal node and set the Cusp Angle to 0 (it’s natural, but not default state) and finally set Houdini to show us our normal vectors (the lines sticking out from our vertices).

Close up of point 3 and the two vertex normals sticking out of each plane.

Now by moving the Cusp Angle upwards we get to a point where the two normals snap together into the same direction. Basically if the angle between the two normals is smaller than the Cusp Angle they will be snapped into the same vector direction – halfway between the two.

Our normals have snapped together

You may be wondering why this is important. It’s not like our shape has changed in the viewport. All becomes clear when we render our shapes. Here are two renders of exactly the same shape first with the normals planar and secondly with them snapped together.

Here we see a well defined sharp edge for the ridge of our bivouac.

And here we see the edge has gone. It’s been smoothed out by the renderer which knows all about our vertex normals and cusp angles and so on.

This may not seem too important and it probably isn’t for a hastily modelled bivouac. But think for a moment about a curved surface like a face or sphere etc.

A sphere with planar normals.

A sphere with snapped normals, smoothed out by the renderer.

So now we know what a point, vertex and primitive are and how they work together to create polygons and from there whole shapes as complex as you like. In addition we’ve looked at one usage of these things to provide us with smoothing for our shapes with normals.

I’m well aware that this subject matter is particularly dry and you’re to be congratulated if you’ve got this far but I like to understand the fundamentals properly – and if you’re reading this at all you probably do too. As we move deeper into Houdini things will become very much easier if we understand how it works at the lowest level.

Edited to add: here’s quick demo I whipped up by changing the parameters over time using keyframes. In addition it uses an attribute transfer that makes the surrounding blobs partially take on the colour of the central one.

Leave a Reply

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