A Very Normal Article (Patreon)
Content
As 3D artists we deal with normals pretty much every day, but what exactly are they? Let’s find out!
Usually when we talk about normals we’re talking about a very specific definition pertaining to surface shading. In this context, a normal is, very simply, the direction perpendicular to a surface.
Take a look at this plane. Its surface normal points straight out, indicating its “front.” If we rotate the plane, the normal rotates along with it, always remaining perpendicular.
Why is this important? Without normals, renderers wouldn’t be able to calculate how light reflects off of any surface.
For simple meshes, implicit normals can be easily inferred by the renderer and we don’t need to supply them ourselves.
However, this breaks down when we make a lot of modifications to a mesh. Say we took a cube, which has very simple implicit normals, subdivided it, sliced it, extruded it, sculpted it, and simulated it, ending up with polygons facing in all directions, extra edges, extra vertices, you name it.
It’s likely that we’d end up with many shading errors, in which case we’d want to apply a normal creation/correction operation in our DCC. All DCCs have some way of modifying normals, but often with wildly varying naming conventions and workflows.
Houdini provides simple, low level-access to all aspects of normal modification, so let’s learn how this all works using Houdini.
We already saw how the surface normal follows the direction a plane is pointing in. This lets our renderer calculate how light reflects off the surface, doing so correctly no matter how the surface is oriented. Note that in the example image above the final rotation shows us the back of the plane, which the viewport renders darker. Without normals that wouldn’t be possible.
What about a sphere? Most of the time we’ll want a mesh like this to appear round, or smooth, when rendered. A faceted look that highlights every individual polygon is reminiscent of ancient video games from the 1980s. We don’t want that unless as a special effect!
With low-resolution geometry like this there’s no getting around the fact that the implicit surface normals are correct. Every surface is facing the right way and the reality is that the object is faceted. We could subdivide the sphere into a million quads, but that’s not very efficient.
There’s a much better solution to this problem that was discovered in the 1970s by scientists Henri Gouraud and Bui Tuong Phong.
Gouraud and Phong shading implement averaged, or interpolated, point normals, which are then used to calculate light ray behavior. Let’s add point normals in Houdini.
The sphere is instantly shaded smooth. Notice that the normal vector for each point is interpolated from nearby face normals. The blue point normals split the difference with the purple face normals. This interpolation is what gives us a smooth surface.
Houdini also offers another option: vertex normals.
(As a reminder: a vertex is one point that takes part in forming the boundaries of a surface. A single point can have multiple vertices. Our sphere here has four vertices on each point because four separate quads meet at each point.)
As you might expect, vertex normals provide four normals per quad intersection.
By default, these four vectors are interpolated just like point normals are. But we can do more with them. If we manually set the cusp angle we can control the amount of interpolation. Set the cusp angle to zero and we have a strongly faceted look again.
The vertex normals all snapped to match their respective quad surface. We could even set this sphere up to render half faceted and half smooth using vertex normals.
Houdini’s default cusp angle of 60 allows for smooth shading of gradually sloping surfaces, but retains hard edges on, for example, a cube where the cusp angle would be 90 degrees.
Well, there you have it! This is really all there is to normals when it comes to shading. Each polygon in a mesh has a “front” and the normal tells us which direction the front is pointing in. The computer can then use interpolated point or vertex normals to create a smooth surface when rendered. Usually, smooth point normals are the look we want, but sometimes exercising more control with vertex normals can lead to interesting effects.
While this covers the most common form of normals that we encounter daily, there’s another important use of the term.
Instead of a 3D surface, let’s look at a 2D curve.
We can certainly talk about the “direction” of points on a 2D curve, and we intuitively can say they’re facing a certain way just by looking at them. While it’s clear to us, a computer has no way of knowing which way is forward, and, by extension, can’t know the orientation of the curve.
In Houdini, the attributes that control curve orientation can be accessed and manipulated using a PolyFrame node. What’s a polygon, or more precisely, a coordinate "frame?” In order to calculate what points are facing where, we need to provide a frame of reference from which to calculate the point’s tangent, bitangent, and… you guessed it, normal.
This is where it gets confusing. We just learned the common use of the term normal to describe the facing direction of a surface. But here we have the same term applied to a different concept. Let’s apply a PolyFrame to our curve, enabling normal, tangent and bitangent creation. (I added a visualizer for tangent, yellow, and bitangent, orange.) Where are the normals?
Aha, there they are.
The normal of each point is oriented straight along the Z axis. That doesn’t make much sense! Shouldn’t the normal be facing “forward” from each point?
Not in this context. In order to know what direction each point is facing we need a fixed dimension that the orientation of the point can be defined against. In this case, the normal provides a third point of reference against a 2D object. The normal here is the front of the plane that the curve rests on, facing forward on Z.
Knowing that, the computer can easily calculate the tangent (parallel) and bitangent (perpendicular) vectors within the frame of the fixed normal direction provided by the reference plane.
The good news is that our 3D apps figure all this out. If we want to sweep a disc along this curve and have it be correctly oriented, we just need to perform that operation and move on. But now we know the math going on behind the scenes!
Bonus fun fact! You can alter the reflective behavior of a surface just by changing the normals. Here I rotated the point normals 45 degrees on X and Z. This causes the viewport renderer to calculate the light bounces differently and so the surface appears darker compared to the (correct) implicit normals.