Blender 3D: Noob to Pro/Deforming Meshes using the Curve Modifier
Understanding the Curve Modifier
|Applicable Blender version: 2.67.|
The curve modifier lets you use a line curve shape to deform a mesh. The mesh will follow every twist and turn of the curve as far as it can bend, depending on how many vertices it has—clearly, the more vertices there are, the more faithfully it can follow the curve.
The curve modifier is also very easy to confuse yourself with if you’re not careful in how you set it up. A common situation is you try to move the deformed object in one direction, but it ends up moving in a completely different direction! This happens when you choose a deformation axis that doesn’t correspond to the predominant orientation of the points in the curve.
There are in fact some predictable rules that govern the behaviour of the curve modifier. Once you understand these rules, you shouldn’t need to keep trying different things at random to try to achieve the effect you want, you should be able to go straight for it.
A Simple Example
Let’s do an illustrative example to clarify things. Start a new Blender document; delete the default cube, and add a grid object instead, with the default 10×10 subdivision to give it plenty of vertices that can be deformed. Also add a path curve on top of it—this will give you a NURBS curve with 5 points, initially in a straight line. The result should look like at right.
The grid object should immediately jump a little way in the direction of the negative X-axis. Why?
Rule One: The offset of the first point on the curve in its local coordinate system is also used to offset the origin of the deformed shape.
If you select the curve andinto Edit mode, you should see that, while the origin of the curve’s local coordinate system (the fat orange dot) is in the middle of the curve, the first point (the one at the end of curve in the same direction that the “centipede legs” are pointing) has a negative X-coordinate. Select just that point, and from the Snap menu + , do “Cursor to Selected”. Now back into Object mode, and from Object→Transform do “Origin to 3D Cursor”. This will adjust the origin of the curve’s local coordinate system to that first point (keeping the curve itself in the same place), whereupon the grid object should jump back to its original location.
Corollary to Rule One: You will make things a lot simpler for yourself if you change the origin of the deforming curve to coincide with its start point.
You can of course freely move around, add and delete the other points. Just be sure to keep that first point always at the origin of the curve.
Now look at the settings for the Curve modifier. Notice those six buttons under “Deformation Axis:”?
Rule Two: The Deformation Axis is interpreted according to the local coordinate system of the deforming curve.
When a path curve is created, all its points initially lie along its local X-axis. Since the default for the Deformation Axis is “X”, all works pretty much as you expect. If the two do not coincide, then weird things happen when you try moving things around.
If you really want to mess around, you could go into Edit mode on the curve, select all its points, rotate them to, say, orient them along the local Y-axis, then get out of Edit mode, select the deformed mesh, and change the Deformation Axis on its modifier to Y, and things should still work consistently. But why bother?
Corollary to Rule Two: For simplicity, ensure that the Deformation Axis corresponds to the primary orientation of the points of the deforming curve in its local coordinate system. Otherwise, the deformed mesh will be rotated from its undeformed orientation, and will go off at a completely different angle when you try to move it.
So long as you obey the above rules, you can move, rotate and scale the deforming curve in object mode only as much as you like, and the deformation will still behave in a reasonable fashion. Of course, you can do what you like to the deformed mesh in object or edit modes, and this will still be true.
Rule Three: The effect of the deformation corresponds to the relative positions of deforming curve and deformed mesh in world coordinates.
Select the curve,into Edit mode, select the middle point, and move it a little to one side, as at right. You should see the grid mesh immediately bend in a corresponding way.
Nowinto Object mode, select the mesh, and move it around: notice how it tries to follow the shape of whatever part of the curve lies nearest to it. What shape does it take when you move it off an end of the curve? How about to one side?
Alternatively, you can similarly drag the curve instead of the mesh, and the same thing will happen: it is only their relative positions that governs the actual deformation.
Also try changing the scaling radius+ and tilt angle + on particular curve points: note how the former causes the deformed mesh to get wider and narrow at those points, while the latter makes it tilt from side to side.
|Applicable Blender version: 2.4x.|
Setting up your Mesh
While this example will be done with a cone primitive, you can use the default cube or another shape of your choosing so long as it can be loop subdivided along the axis you wish to curve. Delete the default cube if you're not going to use it as your base mesh, and add your chosen primitive. In this example, we'll be using a Cone.
- Set your view to the X-Y Axis (Top View) by pressing NUM7, the 7 on the keypad.
- Press SPACE > Add > Mesh > Cone
- A smaller number of vertices are needed, since this cone will become just the tip of the finished shape.
- Left Click and drag to reduce the number of vertices to 12, then click the Ok button. (Note: On newer versions of Blender you will have to hit F6 to get to this option.)
- Press TAB to enter Edit Mode, or choose Edit Mode from the bottom of the 3D viewport.
- Switch views to the Z-X Axis by pressing NUM1 (1 on the keypad). Your screen should now look something like the picture at left.
- If your cone is selected (one or more faces are pink, one or more vertices are yellow) press AKEY (Select/Deselect All) until they are deselected.
- Select the point of your Cone with the RMB and drag it upwards with the blue arrow. You can hold down the CONTROL key if you want to contstrain the scaling to set units. For this example, 5 squares of height were added to the cone.
Extruding the Cone
- Still in Edit Mode, press the NUM8 repeatedly to rotate your view to the underside of your cone. Select the center vertex of the circle, and hold down CONTROL, then press the +KEY on the keypad. This will select all of the adjacent vertices of the base. (You could also select the whole cone AKEY and deselect the top point by holding down SHIFT and selecting it with the RMB to achieve the same effect.)
- Go to front view by pressing NUM1
- Extrude the base of the cone by pressing the EKEY and choosing Region.
- Pull the new vertices away from the cone a distance and click the LMB to set them in place.
- Press the SKEY and widen the new base of the cone a bit.
- Continue extruding the cone, widening the base after each extrusion until you have at least 5 segments. The more segments you have, the smoother your curved cone will be.
- Another way of adding segments is with the Loop Subdivide tool. CONTROL + RKEY to bring up the purple placement ring, then LMB twice to add a subdivision.
- On Blender 2.6, the best way to do it is by selecting the side edges and subdivide them by pressing WKEY then clicking on Subdivide, after that you can select the number of cuts you want.
- You may find that your cone is quite large indeed now, so switch back to Object Mode (TAB) and resize it with the scale tool. While you're in Object Mode, try stretching the cone out a bit to make a nice long needle.
Making a Curve
- In Object Mode, Z-X orientation (NUM1), make sure you have nothing selected and press SPACE > Add > Curve > Bezier Curve
- Rotate your curve 90° (holding down the CONTROL key to make it rotate in 5° intervals) Note- or just R-KEY and then type 90, so that it lines up with your cone. Move it off to one side so that its not hidden by your cone.
- Grab the center vertex of each end and adjust its rotation (RKEY) until you have a nice shallow dome shape.
- Scale the curve in size (SKEY) until it is larger than your cone.
- Look at the panel below the 3D space, you should see the Editing panel is selected (F9KEY) Just below the panel buttons will be a window called Link and Materials. If your curve is selected, you will see a box with OB:Curve in it. This means the name of the curve is "Curve". This is important because that exact name is needed to deform the cone.
Applying the Curve to the Mesh
- Select the cone in Object Mode. In the Editing panel window (F9KEY), the rightmost panel has two tabs, Modifiers and Shapes. Choose the Modifiers tab if it is not already selected.
- Click the Add Modifier button and choose Curve from the popup list.
- In the OB: box, type the exact name of your Bézier Curve (it will be "Curve" without the quotations if you left it as the default.)
- Notice the six buttons underneath the OB: and VGroup: boxes (in the Modifier Panel). They are X, Y, Z, -X, -Y, -Z. They affect which plane the curve deforms. For this example, you'll need to select the Y button.
- Move your Cone so that it overlays the curve in the 3D space screen, and notice how it follows the Bézier Curve.
- You can modify the Bézier Curve as well as the cone repeatedly until you are happy with the design.
- If you switch to Edit Mode, notice that the cone returns to its straight orientation.
- To apply the deformation to the mesh permanently, in the Modifiers panel, click the Apply button next to your Curve modifier.