MART Term 1, Lecture 2
Projects, Components, and Hierarchies

The Hotbox

You've probably noticed that when you press the space bar and hold it down, a big set of menus appears. This is known as the Hotbox. You may also have noticed that it contains all of the menus in all of the menu sets that you can find at the top of the screen. I couldn't do a screen grab, because it involved holding down the space bar, but in rows we have:

In the central bar, we have three additional things. From left to right:

All these are bits of the Hotbox that you've probably already found. But what you may not have found are that if you click OFF the Hotbox (while it's up), little menus pop up too. There is a different menu depending on which area of the screen you click:

NORTH

Different view layouts (Persp / Outliner, Single Perspective, etc)

WEST

Lets you change which type of objects you can select from the viewport

ALIAS

EAST

Display UI elements (if you lose your tool bar, you can get it back from here)

SOUTH

Change the current viewport to, for example, an outliner or a graph editor

The hotbox takes a bit of getting used to, but it can be a very quick alternative to selecting items from the menus.

Projects

Computer animation projects get very big. Even solo projects often have many hundreds of different files, all of which have to be kept somewhere that the software can find them.

Thankfully, Maya can create a directory structure for us that has a specific place to keep various parts of the project.

From Maya, click File Project New. Put "MART" in as the name of the project, and set the location to "~/maya/projects" (this is the default). Click on the Use Defaults button, then click OK.

[screenshot: MART_T1L02_html_137160df]Now if you open that folder (either by using the Home icon on your desktop, or by typing cd ~/maya/projects/MART into a terminal), you will find it has various subdirectories. Most of the directory names make it fairly obvious what should be stored in them (scenes, mel, textures, etc), and we'll come across some of the others later in the year.

Whenever Maya is running, it has a current project: so whenever you open or save a file, the browser will start in the current project's directory.

You can create as many projects as you want: the directories themselves don't take up much space, it's only really the files that are in them. If you go to File Project → Edit Current, you can change the settings of the current project; File → Project → Set changes which project is the current project.

Object types

In the last lecture we made a "Futurama" style building from lots of NURBS primitives. NURBS is only one of the types of objects that we can use in Maya, we can also create primitives from polygons.

Polygons

[screenshot: MART_T1L02_html_4768acdc]The simplest object in a 3D world is a polygon. A single polygon (right) is made up of a number of components: four vertices, four edges, and one face.

We can create primitives from collections of polygons: open up the Create Polygon Primitives submenu, and you'll find polygon equivalents of all the shapes that we used last week. Have a look at some of them. These collections of polygons are known as polygon meshes.

[screenshot: MART_T1L02_html_m7c6bb817]When the objects are selected (or when you are looking at them in wireframe mode (4)), you can see the individual polygons that are used to make them up.

Some objects can be easily made using primitive objects, but these are rare. Generally we have to change these primitives by moving the individual components.

Transforming Components

Create a new scene, and put a polygon cube in it (Create Polygon Primitives → Cube). Get four viewports up, frame the cube in all viewports (shift-f), and put the perspective view in shaded mode (5). We can select any of the different types of components that I mentioned earlier, but we have to be using the correct selection mask. Click and hold the right mouse button (RMB) on the cube, and a mask will pop up. Unfortunately, as you have to hold the mouse button down to see it, I couldn't find a way to take a screen shot of it. It's a series of boxes that let you choose a type of component to select, along with a short menu underneath. With the RMB still held down, move to vertex (so it becomes highlighted) and let go. The object will become blue, and there will be small purple boxes at the corners.

[screenshot: MART_T1L02_html_5785dbbc]Select a vertex; it will turn yellow. You can now transform this vertex in the same way as you transformed the objects last week: press w, and move it around. Note that it will let you rotate (e) and scale (r) a single vertex, but there's no point, it won't do anything. If you have more than one vertex selected, these tools can be useful though: try selecting the top four vertices of the cube, and rotating and scaling them.

[screenshot: MART_T1L02_html_m3c54a639]Go back to the mask by clicking and holding the RMB, and this time select edge. Select an edge (it will go a funny brown colour), and try moving, rotating and translating it.

Finally, pick face from the mask, and select a face (you will have to click the small square in the middle of the face). Try moving, rotating and scaling it.

You may notice that transforming a face has the same effect as transforming the four vertices at the corners of the face. Likewise, transforming an edge has the same effect as transforming the two vertices at the ends of it. It is entirely personal preference whether you like to edit faces, edges or vertices, but don't get yourself stuck only using one: for example, even if you generally prefer to transform vertices, there are times when it is MUCH more efficient to use faces.

NURBS

[screenshot: MART_T1L02_html_40aeeb9b]The other major type of modelling is NURBS modelling. NURBS stands for Non-Uniform Rational B-Spline. You will be forced to learn about the mathematics behind NURBS surfaces later on in the course, but what is more important to get a grasp of at this stage is what they look like (right).

Though this is only a single line, it give the general idea of how NURBS surfaces differ from polygon meshes. A polygon mesh would go through all of the points it was given (as vertices), like the angular brown line in the picture. However, a NURBS surface doesn't go through each point, it uses them as control vertices: the surface is pulled towards the point, but doesn't go through it. The mathematical equation that is used to calculate the shape of a spline results in a very smooth, flowing type of surface. Note that we cannot move the actual points that a NURBS surface goes through, only the control vertices.

NURBS surfaces have different types of components: control vertices, hulls, surface points, isoparms and surface patches. Hulls are lines of control vertices, and can therefore be manipulated in the same way. Surface points are the equivalent of vertices, they lie on the object itself. Isoparms are complete lines of surface points, and surface patches are the equivalent of faces. None of these (surface points, isoparms and surface patches) can be manipulated directly.

[screenshot: MART_T1L02_html_m4bddd0c3]Let's try manipulating the components of a NURBS object. In a new scene, get a NURBS sphere, and bring up the mask (click and hold the RMB).

Select Control Vertex, and try moving some of the points around. Notice that all of the control vertices are flying above the surface, because the surface just moves towards the points, rather than going through them.

We can also move entire hulls: complete lines of control vertices. Select Hull from the mask, and try moving them. You can also rotate and scale hulls, and you can select both vertical and horizontal hulls. We can very easily make an "apple" type object: on a new sphere, select the very top hull (which looks like a single point at the top of the sphere) and move it downwards. Select the bottom hull and move it upwards. This gives the shape of an apple.

So you can see, NURBS can be a very fast way of modelling smooth surfaces. It is possible to get sharp corners with NURBS, but it requires lots of control points gathered in one place, and isn't very elegant. Likewise, it is possible to get smooth surfaces with polygons: the only problem is that it requires a lot of polygons, and navigating around your scene becomes much slower.

Hierarchies and Parenting: Groups

Go to File → Load Scene, and load the building that we made last week. If you didn't save it, go to:

building.ma

[screenshot: MART_T1L02_html_m59187afc]If we want to move this building, how do we do it? Currently the only way is to select all of the objects and translate them. But this is awkward: we have to get them all on the screen at the same time, we have to make sure we get all of the ones we want to move and no others, etc. And what happens if you try and scale or rotate the building? Try it: it's not pretty. Well, maybe it is, but it's certainly not what we want to happen.

The answer? Groups. Select all of the objects in the building, and go to Edit → Group (ctrl-g). What this command does is store all of the objects under an invisible "group" object. This object is called group1 by default; rename it now, if you wish. Open your outliner, and you'll see the group sitting there. Click on the + next to it, and you'll see all the objects that make up the building.

You can still modify any of the components that make up the group in the same way as you could before, but now, if we select the group, we can rotate and scale it as a whole. Try it: it behaves much more like we would expect (and desire).

The group object is the parent of the other objects: they are its children.

Pivots

When we rotate or scale an object, this is done relative to the objects pivot point. Normally this pivot point is in the centre of the object (when a primitive object is created, for example). However, when we created our group, its pivot point was automatically placed at the origin (the centre of our 3D scene). What if we wanted to rotate our building around the top of the spire? We would have to move its pivot point.

Select the group, go into the move tool and press Insert. This switches from transforming the object to transforming the pivot point. Now move the pivot point up to the very tip of the spire, press Insert again (to turn off moving the pivot point), and try rotating the building.

Try moving the pivot point to a few different places. You can move the pivot point of any object, so try moving the pivot point of some of the objects that make up the building.

[screenshot: MART_T1L02_html_29fd036]Another useful tool is Modify → Centre Pivot, which moves the pivot point to the centre of the object. This could be a useful tool to put on a shelf (the line of pictures along the top of the screen: it's up to you what you keep on your shelves), so let's find out how to do that.

To place the tool from the menu onto the shelf, press and hold Alt and Shift, then find and select the menu item that you want to put on your shelf. Once it's on the shelf, you can move it around the shelf using the middle mouse button (MMB). You can also move it onto a different shelf by MMB dragging and dropping it onto the tab of the shelf you want it on. Finally, when you get bored of having it on your shelf, you can MMB drag it into the little dustbin at the end of the shelf to get rid of it.

Complex Hierarchies

Grouping the objects like we just did is a simple form of an object hierarchy. Objects in Maya can be placed in hierarchies in order both to organize them, and to assist in animation.

We're going to use the scene:

robotarm.ma

But lets get what's in it a different way. Get a blank scene, and select File → Import. Had we had anything in the scene already, this would leave those objects there and bring the new scene in too.

[screenshot: MART_T1L02_html_m64244a6c][screenshot: MART_T1L02_html_mfafdbfd]You should now see a group of objects (right) that make up a robotic arm (below). If you open up your outliner, you'll see that the armRotation object (a sphere) is already correctly placed and parented (click the "+" next to "base"): thus, if we move the base, this sphere goes with it.

[screenshot: MART_T1L02_html_m477bd880]Have a go at placing the objects in a hierarchy, so that when the objects are rotated, the arm behaves the way we would expect it to. In order to place the objects in a hierarchy, use the MMB to drag them on top of another in the outliner. The pivot points are already set correctly, by the way.

Try to think about which objects should be affected if another one moves. Relate this to the fact that children are affected if their parent moves, but the parent is not affected when its children move.

When you think you've got it, try rotating all the bits and see what happens. It will be fairly obvious if you've not got it quite right.

[screenshot: MART_T1L02_html_19b0538]Here is the correct hierarchy. Note that if you shift-click a "+" symbol next to a hierarchy, it will expand fully, not just one level.

A lot of the most complicated and confusing things involved in computer animation projects require very complex hierarchical structures: it is worth getting comfortable with them now, it will make your life easier later on.

Next week we're going to do some simple animation, and we're going to re-use this robotic arm. If you want to, before then, you can make it a bit prettier: maybe add more joints, or make the arm split half way and have two smaller arms come out of the side. Do whatever you want, use your imagination, but do bear in mind that you will have to animate every joint, so it would be best not to have hundreds. You don't have to change it at all, you can use this one, but the only way to get better with Maya is to practise.