MART Term 1, Lecture 6
Deformers , Turntables and Fly-Throughs

# Deformers

Today we will look at several different types of deformer, which are on the` Deform `menu in the` Animation `menu set. They are on this set because they can be used to animate the shape of objects, but they are also handy for a modeller to have in his toolkit.

Create a polygon cube with 25 × 50 × 25 subdivisions, and stretch it in the y axis. We will use this object to test out all of our deformers, so let's duplicate it. Do a standard duplicate (with the settings reset), and then move the object along so that it's well clear of the other one. Then, instead of ctrl-d press `D` (shift-d). You should notice that it duplicates the translate as well, so if you do this four times we end up with six objects evenly spaced.

# 1. Bend

Select the first object and apply a bend to it (`Deform → Create Nonlinear → Bend`). We're going to be going to this menu a lot, so you could tear it off (click the little strip at the top of it) if you want. When you apply the bend, it will not be immediately obvious what has happened, but you should see that we have a new input in our construction history. We're going to change the `curvature`, but we're going to do it a new way. Make sure you are in the select tool (press `q` to be sure), then select the parameter `curvature`. Now MMB click and drag in any viewport, and you should find you are controlling the curvature using a virtual slider.

You'll notice that the curvature does not work in degrees. Why? Who knows. It works using radians: if you type p (3.142) into the curvature box it gives you a full circle. We can type things other than text into these boxes: another useful thing you can type into them is something you may have come across in programming or scripting. For example, with 3.142 in the curvature box, click to change it and enter` /=2`. This is like C, where we can type` curvature/=2; `to halve the value that is stored in the variable curvature. The other operators (`+=`, `–=`, and `*=`) also work. Leave it on the value 1.571, and move highBound down to 0. You should find you get a 90 degree bend.

Notice the `envelope` parameter: every deformer we will look at today has one. This is a measure of how much the deformer affects the object: if it is set to 1, the deformer has full effect; the effect lessens as `envelope` tends to 0, when the deformer has no effect. This is mostly useful when animating, in order to smoothly turn the deformer on and off.

# 2. Flare

Select the next polygon cube, and click` Deform → Create Non-linear → Flare`. We could edit it in the channel box like we have before. This time, though, press `t` to bring up the` Show Manipulator `tool: you should have a circle at the top and a circle at the bottom of your object, each one having two little blobs on it. Clicking and dragging these blobs lets you flare the object out at either the top or bottom. Clicking and dragging on the centre of the circles allows you to set the minimum and maximum height of the operation. Try using the `curve` parameter too: this gives you a curved flare rather than a straight edge.

# 3. Sine

The sine operator displaces the points on the object in a sine wave. Select the third object, and put the` Deform → Create Non-linear → Sine `operator on it. Yet again, it appears to do nothing immediately. In the `sine1` input's parameters, increase amplitude and you will see the sine wave form. Notice that the operator also creates a new object: `sine1handle`. All of the deformers described here produce these handles: the handles can be transformed in the same way as any other object. Try it out.

Also try changing all of the parameters of the `sine1` input; most do what you'd expect. The parameter `dropoff` reduces the effect of the sine wave towards the extremities.

# 4. Squash

If you remember back to our lecture on basic animation, I mentioned squash and stretch, and suggested that you implement it using the scale attribute of your ball. Though this would work fine in some circumstances, it is often better to use the squash deformer. Try it out on the fourth block now. Use a virtual slider to edit the factor parameter, and you will see that as well as scaling it down in the y axis, it also bulges it out in the x and z. Again, play with the parameters and see what they all do: notice that yet again we have envelope, lowBound and highBound parameters. These are common to all of the deformers in this section.

# 5. Twist

Try twist on the fifth cube. It does pretty much what you'd expect it to, and has very few unique parameters: `startAngle` and `endAngle`, which are fairly self-explanatory. A very useful tool.

It is worth remembering here that if you are intending to use these tools purely for modelling, and have no intention of animating them, then be sure to delete your construction history when you have your settings the way you want them.

# 6. Wave

Unsurprisingly, this is very useful for making rippled surfaces: probably more useful for animation, but for the sake of completeness I'll show it to you now. Apply it to the last cube, select the handle (`rippleHandle1`) and rotate it by 90 degrees in x. Now increase the amplitude parameter, and see the ripples emerge. Pretty much all the parameters are ones you have seen before, have a play with them and make sure you know what they all do. The ripple deformer is the exception that proves the rule: it doesn't have a lowBound and a highBound, but rather a minRadius and maxRadius.

# 7. Lattice

Now we move away from the non-linear menu. Select your favourite of the first 6 cubes, and select` Deform → Create Lattice `❐. Set the `divisions` to `3`, `5`, `3`, and click `create`. Now we have a lattice (a 3D grid) that we can use to adjust the shape of our object. Select` Lattice Point `from its marking menu, and try changing the shape like you would any other object. This is an incredibly flexible tool: a lattice can be deformed in any way, we can even deform the lattice using other deformers, such as bends or twists.

# 8. Wrap

Very similar to a lattice, but this takes in two objects: one that is deformer (like our cubes earlier) and one that does the deforming (like the lattice above). One particular use for it is to use a low poly mesh to replace a very complex mesh, and then wrap it later on. I won't go through this now, but it's worth having a play round with this in your own time if you think it might be useful.

# 9. Sculpt

Select one of the previously deformed cubes, and select `Deform → Create Sculpt Deformer`. At first glance, it appears to just dump a sphere on top of your object. Go into the outliner, and select `sculptor1`. Try making it much smaller, then try moving it around. You should see that it moves the polygons of your object out and makes it "bulge". Again this tool is very powerful, and there are lots of options to play with to get it to work for you.

# Rearranging Operators

Have a go at this: apply the bend operator to your twisted cube, and put the curvature in as 1.571 again. You'll see that it creates what you'd expect: a twisted cube that's bent (like the one on the right-hand side of the picture here). But if you try adding a twist operator to our bent cube, it doesn't work the same (left-hand side of figure on left). Thus it is obvious that the order of operators does matter. The same as in real life, if you twist a bent object, it isn't the same as bending a twisted object. But we can change the order of the operators. On the object that was originally only bent, hold the RMB down to bring up the marking menu, and go to the` Inputs → All Inputs... `menu item. This brings up a list of all the operators. If you drag the names with the MMB, you can change the order: try swapping the order of `twist2` and `bend1`.

# Turntable

For your modelling project, you have been asked to make a turntable. There are several ways to make a turntable, the easiest being to go to` Turntable `on the` Animate `menu. This isn't ideal though, as it only turns the object once, and doesn't allow for camera movement. A better way, IMHO, is to set an expression on the rotateY of the object. Let's try it now. Select your favourite of the 6 deformed boxes, and use that one.

Open up the attribute editor (not the channel box), and click on the rotateY box to enter a value. We can enter some simple expressions directly into this box, without having to worry about the expression editor. Type in` =frame `to get the object's rotation to be equal to the current frame number, and thus to get it to rotate. Now play back the animation, and you should see some rotation. However, if, like me, you chose the bent (or sine, twisted, or rippled) cube, strange things will probably be happening. The reason for this is that although the object is rotating, the deformation handle is not. Thus it appears that the deformation stays still as the object moves. We can solve this one of two ways. The first is to delete our construction history before we make our turntable: this is a good idea anyway, but if we intend to animate the deformer later on we cannot do this. The other option is to parent the handle underneath the object: i.e. make bend1Handle a child of pCube1 (or whatever the deformed cube is called).

Finally we can vary the speed of the turntable by changing the expression: type in `=frame*5`, and the animation will be quicker. Vary this number to get the speed that you want.

# Creating a Canyon

Finally today, I'll show you one way to do a simple fly-through. First of all, we'll make a canyon to fly through.

Create a NURBS plane, and change it so that it has 10 patches in each direction. Now draw a curve for your canyon (in a top view). Select both, and use yet another deformer: the wire deformer (`Deform → Wire Tool)`. This allows us to use the wire (the curve) to push the surface of the object down. Try it, and use it to make a canyon-style trench along the surface (you may want to adjust` dropoffDistance[0] `to get it looking nice). Now select the surface, and delete its construction history. Then move the curve upwards so it runs through the canyon. We will use this curve to track our camera along.

# Fly Through

Click on` Create → Cameras → Camera `to create a single camera without an aim. In order to make this move along our curve we will use a motion path. Select both the camera and the curve and click on `Animate → Motion Paths → Attach to Motion Path`. This attaches the camera to the curve, but the first thing you'll notice is that the camera isn't pointing in the right direction. Look at the motionPath1 input of the camera in the attribute editor: you'll see that there are three "twist" parameters. We want to change the` Up Twist `to -90. Now play around with the other settings; try turning Bank on, for example.

You may find at the moment that your animation is much too fast: by default, the animation goes from the start to the end of the motion path between the first and last frame of the current playback range. To edit this, click on the position marker at the end of the curve (the number). Now look at its attributes, and you should find that one is the time that the camera gets there (`Time `in` Position Marker Attributes`). Change this to whatever time you desire. You can add more keys by keyframing the` U Value `attribute of the motion path node. Don't forget, you can also move the points of the curve around, and the canyon will not be affected because we've deleted the construction history.