In the latest excerpt from *The Magic of Houdini*, Will Cunningham discusses developing 3D concepts.

*This is the next in a series of excerpts from the Thomson Course Technology book * The Magic of Houdini* by Will Cunningham. In the next few months, * VFXWorld* readers will learn the basics of the dominant tool that has been used in the creation of some of the most awe-inspiring animation and cinematic effects ever made.*

### Where is 3D?

So you are determined and excited now, right? That is good, because before you can jump into the glory of creating an alien world or a terrestrial apocalypse, you must first ensure that you have a solid understanding of the 3D concepts that comprise your new environment. Most of you have, at one time or another, had the experience of measuring a mattress. After all, how else can you ensure that every square foot of your room is covered in springy good times? After taking these measurements, you usually describe them in terms of a width, height and depth. Now imagine you are floating above and looking down on one mattress. From this perspective, the left to right measurement indicates width, the top to bottom measurement indicates height, and the measurement from the top side to the back side of the mattress indicates depth.

This sort of visualization is easily understood in terms of 3D coordinate systems as well. Houdini uses a rectangular coordinate system that is basically the same as the one René Descartes created way back in the 1600s. In fact, the story goes that René was lying in bed while watching a fly. At some pivotal moment, he realized that he could exactly describe the flys position by using just three numbers. He devised a system wherein each of the axes described above was designated with a letter: x for width, y for height and z for depth. The point at which each of these axes intersects is called the world origin. This point divides each axis into a positive and a negative side. Houdini uses a right-hand coordinate system, which means that x values become larger to the right of the origin and smaller to the left, y values become larger above the origin and smaller below it and z values become larger the nearer the viewer and smaller as they are farther away from the viewer. Figure 1 shows this type of system.

Using this system, you can give any point (or fly) a position in 3D space using the world coordinates x, y and z (x,y,z). For example, (0,1,0) indicates a point one unit above the origin. (-4, 3, -2) indicates a point that is four units to the left of the origin, three above it and two units forward, or into the monitor.

When using the terms left, above and into, it is important to remember that these are somewhat loose terms. They describe the default state of the coordinate system in relation to the viewer. However, if the view is changed in some way, those terms might no longer be accurate. The new view might be showing positive Y going down, to the left or some other direction. So, it is important to remember that the generic terms only apply when the axes are being viewed in the default, home position.

Another important point to consider is that the units in Houdini are arbitrary real-world distances. One unit to the right doesnt necessarily mean 1 meter, 12 inches or 1 mile to the right. The units are adjusted to whatever seems most useful for the particular project at hand.

### The Building Blocks of 3D Space

Now that you have an expansive playground before you, how do you begin to create sandboxes and swings to populate it? Every complex 3D model is comprised of smaller and smaller building blocks, just as we humans have bodies comprised of organs, which are comprised of cells, which are in turn comprised of atoms, which are then comprised of quarks, which are likely comprised of ever smaller phenomenon we have yet to discover. Fortunately, the aspiring 3D artist can treat the point as the smallest measurable unit.

So, place a single point out there in the void and suddenly your universe is populated! Place another point out there in a different location and you begin to play. Connect these two points and you have now created what Houdini calls an edge, which is a polygon face or curve. Experience the grandeur of evolution! Place yet another point off to the side somewhere and connect it to one of the points. Check out Figure 2 to see where this is going. Houdini calls this an open polygon.

Polygons are created from one or more connected straight edges. These edges are defined by the vertices that comprise them. Now, make the final evolutionary leap and connect the unfinished side, thereby creating a triangle composed of three edges and three vertices. You now have a closed polygon, because you can define the shapes inside and outside.

### Points and Vertices

It is important to note that vertices and points arent exactly the same thing. As stated before, a point is a position in space defined by coordinates. Polygons (or other primitive types) are built on top of these points using vertices. A point can exist all by itself and be happy. In order to have a vertex (happy or otherwise), you need to have a primitive that it is a part of, in this case, a polygon. Vertices cannot live by themselves as points can. So, a vertex must reference a point, or a position in space, in order to build a polygon primitive.

Several primitives can have unique vertices that each reference the same point. In Figure 2, two triangular polygons share a point, or position in space. Each of them has their own unique vertex at that position in space and that position information is contained in the point. In other words, a point is considered the generic holder of a position in space, whereas several vertices can occupy that position and be unique to its accompanying polygon.

### Primitives

As the term primitive was just used, this is a great spot to define it with relation to Houdini. In the 3D universe, a primitive is often considered to be any of the basic 3D geometric forms that packages offer as building blocks for more complex operations. The sphere, box (cube), tube (cylinder) and cone are examples. In Houdini however, a primitive is a more inclusive term. On the one hand, it is a type of geometry. Anytime you have two points connected by an edge, you have created a primitive. So, a single polygon is a primitive, or a single NURBs patch is a primitive.

However, just to make things nice and confusing, there is also a type of geometry called primitive. When geometry is of type primitive, it is actually a single point that defines a shape. This single point is used in a relatively simple equation to then create the shape. There are only a few shapes that are of type primitive, including the sphere, cylinder and the torus. For example, a sphere of type primitive uses the equation x2 +y2 + z2 = r2 to generate its form. Using geometry of this type can be useful in saving memory and increasing interactivity in complex networks because their forms are represented by relatively simple equations. These types of primitives can be transformed in different way. Because they are defined by a single point, they cannot be subsequently deformed and so are of limited usefulness. To understand the difference between transformations and deformations, check out that section later in this chapter.

See Figure 3 to view spheres using the two distinct definitions of the word primitive. The sphere on the left is of type primitive. The sphere on the right is comprised of many polygonal primitives.

### Planar and Non-Planar Geometric Forms

Two of the basic forms for geometric creation are the triangle and the quad. A triangle is comprised of three connected edges and three vertices. A quad is created when you add one more point off to the side and connect it. A quad is comprised of four connected edges and four vertices. An important point to consider when modeling with complex polygons (quads or greater) is that it is possible to make them non-planar.

A polygon is either planar or non-planar. A polygon is planar when all of its vertices lie on the same plane in 3D space. A polygon is non-planar when one or more of its vertices do not lie in the same plane in 3D space. Consider the triangle you just created. Assume two of the vertices are stationary. Now, you take the third vertex and move it up and down. Anywhere you move it, all three vertices will always lie along the same plane or be flat when viewed edge on. A triangle polygon is always planar because of this. Imagine taking a notebook sheet of paper and folding it diagonally into a triangle. Lay it flat on a table and the three corners lie within the same plane and so are planar. Now pick up one corner (pretend the paper is very stiff); you can see that all three corners still lie within a single plane when viewed edge on and so the polygon is still planar.

Take a quad, on the other hand, and assume three of the four vertices are stationary. Now take the remaining vertex and move it perpendicular to the plane that the quad lies on. When viewed edge-on, you can see that this polygon is now non-planar. In other words, unfold that sheet of paper so you again have a four-sided page lying flat on a desk. All four of its corners lie within the same plane and so it is planar. Take one corner of the paper and lift it up and now you have one point that no longer lies within the same plane as the other three. The paper is now non-planar. Figure 4 shows the triangle from above and from the side and also the quad from above and from the side. The quad has its upper-left point pulled up and so had made it non-planar.

It is important to keep this difference in mind, because some modeling, rendering and dynamics operations dont function correctly when applied to non-planar surfaces. To fix the quad (or notebook paper), you can either move the single point back in line with the other three points or split it diagonally with an edge and create two connected triangles, which, as I said before, are always planar.

### Convex and Concave Polygons

Another important characteristic of polygons is whether they are convex or concave. A convex polygon is one in which any horizontal or vertical axis intersects it no more than twice. A circle, box and triangle are examples. A concave polygon is one which any horizontal or vertical axis intersects it more than twice. A star and crescent moon are examples of concave polygons. Some modeling and rendering operations dont function correctly when applied to concave polygons. So, it is important to know the difference when working with geometry. See Figure 5 to get a look at this.

*Find out more about how to apply each of Houdinis features to your projects as you take on modeling, character animation, particle effects animation, dynamic simulation animation, shading, digital asset creation and rendering. *The Magic of Houdini* by Will Cunninham. Boston, MA: Thomson Course Technology, 2006. 355 pages with illustrations. ISBN: 1-59863-082-2 ($49.95). Check back to * VFXWorld* frequently to read new excerpts.*

*Will Cunningham began his trek by studying both traditional art subjects and 3D computer software at the Academy of Entertainment and Technology. After his studies, he was hired as a Houdini technical intern by Side Effects, the developers of the Houdini software package. Eager to create effects for the big screen, he then jumped into production with BlackBox Digital on the feature, * The Prince and Me*. Shortly thereafter, he also began teaching Introduction to Houdini at the Academy and has since taught both the introductory and intermediate Houdini courses. In the fall of 2004, he was awarded a fellowship grant by Santa Monica College to support his efforts in creating this book. Over the years, Will has worked for a number of production studios on a variety of projects including* The Chronicles of Narnia: The Lion, the Witch and the Wardrobe*, * Open Season* and * Ghost Rider*. Currently, he is enjoying effects challenges and learning opportunities at Sony Pictures Imageworks.*