Sunday, May 29, 2011

Tutorial: Restricting a Nonlinear deformation to a single axis

**( If you are already familiar with the Nonlinear deformers, you can just scroll down to the "Let's get started!" part. )

Many times when modeling, you may come across a situation that requires a complex shape to be created that would take quite a long time to do properly by hand, and even still not look very good. One such scenario is a screw, if you were to try and model all the threads by hand, this would take a very long time and still not look very good, most people wouldn't even know where to start. But, with the help of the Twist deformer for example, this task can be done within minutes by merely twisting an object that has every second edge pushed out further, and with enough divisions to support the twisting effect.

If you do not know about the deformers, they are located in Create Deformers>Nonlinear, which is a menu option when the menu is set to Animation. (By default your menu bar is set to Polygons)

Another scenario is bending pipes. A smooth bend that keeps proper volume can be time consuming to do by hand and still won't be 100% proper. But using the Bend deformer, you can easily bend the pipe smoothly to almost any angle and still retain it's volume in the bend.

These are only two examples, and there are a few other deformers and many other uses for them, especially when dealing with high poly objects that you need to smoothly change the shape of.

So lets get on to what this tutorial is about. The Flare deformer. This deformer has two circles at the bottom and top, which it interpolates a curve between, the amount this curve bends being defined by you. When applied to an object or vertices, it will squish or expand those vertices according to that curve. Which is very helpful for creating various cylindrical objects, such as vases, or for creating squash and stretch, as well a plethora of other uses for animation since the parameters can be keyed and the deformation tool can be translated, rotated and scaled to change the location or result of the effect on an object.

Flare deformer being used the typical way

Since the Flare deformer works in a cylindrical fashion, it's going to bend your object inward/outward all the way around it. So what can you do if you only want to get that nice smooth curve deformation happening from a single direction? Which is usually the case with objects that aren't cylindrical or when only wanting to deform a small portion of something.

Well, that's what this tutorial is going to be about.

Let's get started!

In this tutorial, we will approach the problem of smoothly deforming the lengthwise shape of a pipe. Which obviously would be part of a scenario where you are creating pipework that requires some braces, seals or caps that are custom made to fit certain things, such as a T joint.

Here is a picture that shows what the typical result would be like if you just went ahead and used the Flare deformer, along with the proper result we want, achieved using the method in this tutorial.

So now let's create the proper result.
1. 'Create>Polygon>Pipe'. Give it a good amount of divisions so it's a fairly smooth pipe, simulating a scenario where moving the points by hand isn't ideal. And give it the amount of thickness you'd like.

2. 'Create>Polygon>Plane'. Rotate it 90 degrees so it is aligned lengthwise with your pipe. 
Give it a higher amount of height divisions than your pipe has from a front view, and no other divisions. We want it to have it a lot so that our deformation is smooth.

3. Select the Pipe and then Shift+Select the Plane.
Go to 'Create Deformers > Wrap' on your menu bar (Set the menu to Animation to see the option). 
Make sure to set the Wrap options to "Exclusive Bind".
 Basically what 'Wrap' does, is it turns the second object into a lattice for your first object. So whenever you move points on the Plane for example, it will move points on the Pipe. And since we are using a Plane which is a 2D object as our lattice for the Pipe, the deformer will only be able to deform it length-wise and not width-wise since it has no width. This deformation will then be transferred to our Pipe

4. Select the side points of the Plane up to the point you want the curve deformation to start.
(Or you can select them all like I did here, and just change the start position of the deformer afterwards)

5. With the points selected, go to 'Create Deformers > Nonlinear > Flare'.
Rotate the newly created Flare tool to an appropriate position for the deformation direction we want.

6. Now in your Attribute Editor, which should be open on the right side of Maya, play with the values in the "flare" tab to get the deformation you want.

*The High & Low 'Bound' defines the distance of the top and bottom deformation circles in relation to the center. So if you lower them, anything outside of them won't be effected by the deformation. And if you raise them, you can create more gradual curves.
*The Start/End Flare values define the X/Z scale of the circles. So you can have an elliptical shape instead of a uniform cylinder.
*And the 'Curve' value of course defines how bent the curve is between the circles.

Now we have a custom pipe joint created which has retained it's volume and cylindrical shape. If we are done and know we will not need to make anymore modification to the deformer, we can simply go to 'Edit > Delete by Type > History', which will freeze the vertices into their new position and delete the deformer tool.

This technique can of course be applied to any of the other deformers also, to restrict an effect to one axis. And if you do not delete the history, you can keyframe the Flare values to create an animation of the pipe taking shape.

Thank you for reading my tutorial. I hope you found it helpful in giving you new ideas on how to approach the modeling of various objects, and also for expanding your toolset. This was only one technique I developed for one set of problems. I recommend people to play around with the other deformers, figuring out for yourself different ways you can use them in the modeling and animation process. As they are quite useful.

No comments:

Post a Comment