MART Term 1, Lecture 4
Polygon Modelling & Referencing

# Hotkeys

This week we are going to do a short "point pushing" exercise: we are going to model a simple spaceship using polygon modelling. The thing that most people remember about polygon modelling is that it often involves using the same tool repeatedly. For example, it can get very tedious to go and get Edit Mesh → Split Polygon Tool over and over again. There are two solutions to this problem: one way is to assign the Split Polygon Tool (or any other) to a hotkey. Let's try this now. Go to Window → Settings / Preferences → Hotkeys (right): this gives a list of all the commands in Maya, divided into categories.

The first thing we've got to do is think of a key to put Split Polygon onto. Maybe S? (Note that a capital S means shift-s.) Put S into the Key box on the right of the window and click Query. This looks shift-s up in Maya's list of hotkeys, and gives the result that "S" is assigned to: KeyframeTangentMarkingMenu. So we can't use that (well we could, but it would replace its current assignment; we won't do that now). Let's find which keys aren't being used. Click on the List All... button. It will give you a list of all the mapped buttons, along with (more helpfully) all the unmapped. Check out the list. What about '\'? We could use that. Close the window, then type '\' into the Key box. Now we need to find the command that we want to assign to it. It's on the Edit Polygons menu, so lets look at that category: sure enough, there it is. Click on it, then click Assign. Now we can close the window and use '\' to enter the Split Polygon Tool rather than have to dig it out of the menus.

# The Letter 'G'

There is another option: if we want to do the same command over and over again, we can use Edit → Repeat command. This repeats the last command that we carried out. Clearly this isn't terribly useful, as we have to dig this out of the menu, but it does have a hotkey pre-assigned: g. You should use the g key as often as possible, it can save you a lot of time. We will use it a lot in this lecture.

# Spaceship

We're going to build a simple spaceship out of polygons. Before we start:

• Make sure the construction history is on (the little scroll button on the top row of icons next to the first of the clapper boards).

Get a Poly Cube in four view, and put the perspective view in shaded mode. In this example we will regularly be selecting faces, and one thing that you may find is that when you select faces on the front of an object, one or more faces on the back (from your point of view) of the object are also selected. In order to get round this we will turn backface culling on. Select Display → Polygons → Custom Polygon Display ❐. In the backface culling box (at the bottom) choose on. Now try drawing a box over the whole cube: you will notice that only the faces on the side of the cube facing you will be selected.

1. Scale the cube up in the Z dimension

2. Press F8 to go into component selection mode, and use the buttons on the status line to turn OFF points selection mask, and turn ON face selection mask.

3. Select the two faces on either side of the cube (by tumbling around it). Select Edit Mesh → Extrude.

4. Click and drag the blue move handle (the arrow) to extrude a new face.

Notice that when you move the face nearest you towards you, the face furthest moves away from you. They are moving relative to their own surface normals.

5. Use the green scale tool (the box) to slim down the two new faces.

6. Press the g key to apply the extrude tool again. Scale the new faces down so they're really skinny. These will become the wings.

7. Press g again, move the new faces out and back, and scale them down in the x direction.

Now we're going to add the top fin. This will involve splitting the top centre polygon into sections, which we will achieve using Edit Polygons → Split Polygon Tool. Remember we assigned it to '\'.

8. Select the top centre polygon, and press f to frame it. We could use \, but we want to change the options first, so go and get it from the menu. Set the options to Number Of points = 6, Snapping Tolerance = 100. The number of points means the number of divisions that we can divide an edge precisely into, and the magnet tolerance is how likely the point is to snap to a magnet. We have set the tolerance to 100, so it will always snap to a magnet.

9. Now divide the top face into three sections, the middle being slightly narrower. Don't worry about being overly precise, but try and make the new edges straight.

10. Select the narrow central polygon and extrude it (try using the Recent Commands section of the Hotbox). Move it up and back, and make it slightly shorter.

We're now going to use the extrude command to move some faces IN, as opposed to out as we have been using it up to now.

1. Select the two faces at the front of the ship on either side. Press g to get the extrude tool back up, and scale the new faces down a bit without moving them. This will become a small lip on the edge of our spaceship's thrusters.

2. Now extrude the faces again: make them the same sort of amount smaller, but this time move them back as well.

3. Extrude the faces again, and move them deep into the spaceship.

4. Now do the same sort of thing on the face in the centre at the back: create a lip, move the face back slightly, extrude again and move it far back.

5. Now we'll make the nose: take the front face, extrude it once, and move it out slightly. Extrude it again, move it out, and scale down the new front face so that the nose of the craft is a bit more pointed.

Now we have the complete skeleton of our spaceship, but our spaceship is too angular, everything is a bit too precise. We have two choices from here: we can either keep our box-like structure, or go for something a bit more smooth and organic. If we want to keep our box-like structure, we should bevel the edges. This is carried out to try and make a surface look more realistic: no edge in real-life is completely sharp. Select the polygon at the top of the fin, and try doing Edit Mesh → Bevel. It gains a curve (albeit a very crude one) at the edges (right). If you play with the options of it, you'll find there are a lot of ways to make the curvature bigger or smaller, and more or less crude.

But lets try making the whole spaceship more smooth. Select the object, and pick Mesh → Smooth (making sure to use the default settings). You'll see that the spaceship becomes a bit smoother, but it's still very angular. With the spaceship selected, open up INPUTS in the channel box and find the options of the smooth tool. There are a lot of very useful options in here, but the only thing we're going to change at the moment is the Divisions: change the value to 2. When we originally smoothed it, it created 4 new polygons for every one on our original mesh. Now there are 16 polygons for each original polygon.

Note also that we can change any of the extrusions that we carried out earlier. This is due to Maya's construction history: by default, Maya remembers every action that we have carried out to produce our object. For example, click on the last extrusion we carried out (the top one on the list). Now press t: this brings up the transform manipulator (like the one that pops up when we do an extrude in the first place), and we can adjust it. Notice that we can see the final result with the smooth on top, even though the object wasn't smoothed at that point.

# References

When you import a file in to Maya rather than open it, you add new objects to an already existing scene. Referencing is an extension of this: it lets you import the same object into different scenes, and then change the original object and have the objects in all of the scenes change too. Let's look at an example.

Firstly we're going to have to copy the folder across. From a terminal window, run the following command:

cp -r ~hbush/MART/T1L04/ref ~/

You'll find a version of the spaceship that we have just made (you can use your own, if you prefer). This is the scene that we are going to refer to in another scene.

As the name suggests, this is the background for the spaceship. Let's read the spaceship in as a reference then.

Go to File → Create Reference , reset the settings, then click Reference. Select the correct file (/bacva1/[yourusername]/ref/refspaceship.ma), and the spaceship will appear in the scene.

Have a look in the outliner, though, and you'll see that things are a little bit different. The basic structure is the same: the engineLight is parented to the spaceship. The main difference is the icons: they have a little R in a square on them, indicating that they are referenced. The names are also different: they both start with ref_spaceship. More importantly than that, we aren't allowed to change the name. Try it and see: neither the outliner, the channel box or anything else will let you change the name. That's because the object is read-only: we can add to it, for example we could add animation to the translateZ to make the spaceship fly across the screen, but we can't change anything that's already there. For example, we can't delete the history of a reference, but we can add a new operation (such as an extrude) to the history.

Save this scene (as, e.g., refeverything.ma), and go back to our spaceship scene. Try changing something in it: you could change the colour of the spaceship, or change the last extrude so the nose is longer, or anything like that. When you go back in to the other scene, as if by magic it will have updated to reflect these changes.

Now try adding more spaceships, and translate them around until you've got about 8-12 (don't forget to utilize the g button). Save this file (as something like ref-lots.ma) and then go to File → Reference Editor. This will pop up a window which allows you several ways to control your reference:

• Create a new reference

• Import the object that is currently referenced, so that it isn't a reference any more

• Export the selected unreferenced object to a file, and then reference that file

• Temporarily show or hide a referenced object

Try importing all of the references into the scene as real objects, and then saving the scene under a different name (maybe noref-lots.ma). If you look at the relative sizes of the two files (e.g. in a terminal window), you should see a huge difference: even taking into account the size of the spaceship file which is referenced, the sizes are 0.5 Mb vs 3.8 Mb.