Paint with Illustrator's Gradient Mesh
Gradient Mesh is a grid-based painting technique in Illustrator that enables advanced coloring of vector objects with smooth and malleable color transitions. If you’re reasonably familiar with Illustrator’s Pen tool and other path-drawing, selection, and color tools, you can use the Gradient Mesh feature to add realistic coloring, lighting, and 3D characteristics to a flat vector object. Ultimately, gradient mesh can give you the effect of photo-realistic painting with all the benefits and freedom of resolution-independent vector artwork.
Gradient mesh vs. standard gradient: Standard gradients are extremely limited. You can choose between linear gradients, which transition from one color to the next in a straight line, and radial gradients, in which colors transition between concentric circles. A gradient mesh can transition colors in any direction, in any shape, and can be controlled with the precision of anchor points and path segments.
Gradient mesh vs. object blend: Blending objects in Illustrator involves selecting two or more objects and creating intermediary objects that morph into each other. For example, the blend of a red triangle in front of a blue square would create additional objects between the two that gradually morph the shape and color of the triangle into those of the square—at the exact midpoint you get a purple shape that is half triangle, half square. Object blending is an effective way to create irregularly shaped color transitions and gradients, but it’s labor intensive. Each new gradient must be created as two objects—the starting and ending color object—and blended individually. A gradient mesh, on the other hand, is a single object inside of which different color areas transition into one another with the effect of a blended object.
Gradient mesh vs. painting in Photoshop or Corel Painter: Painting in Photoshop or Painter is far easier than creating a gradient mesh. But such painting means working with fixed-resolution pixels. Conversely, a gradient mesh in Illustrator is a resolution-independent vector object, which means you can scale it up or down to infinity and maintain its original quality. Pixel-based imagery loses quality as it’s scaled up. Moreover, colors in a gradient mesh object can be perpetually adjusted and altered, whereas adjusting a painting in Photoshop requires re-painting, potentially destroying data.
Creating a gradient mesh
Creating a gradient mesh is fairly intuitive once you grasp the basics. So let’s get started by coloring a simple tomato via a gradient mesh.
Begin by drawing the shape of your tomato as a single closed path with the Pen, Pencil, or shape tools.
Choose a base color for the tomato, and fill the path with that color. You can pick any color you like, but for reference I started with RGB: 185, 44, 7.
With the tomato path selected, choose Object->Create Gradient Mesh. You will see the Create Gradient Mesh dialog.
Because a gradient mesh is a grid, when converting a path to a gradient mesh object, you must initially divide the object into expected areas of color—you can add and remove rows and columns later. At each intersection of column and row lines within the grid is a mesh point, which behaves very much like—and may be called on your screen—an anchor point, which controls the direction and curvature of path segments emanating from it. The difference is that a mesh point can also hold a color value, and that is the whole point of a gradient mesh. Colors transition between mesh points. For instance, in a 2-by-2 black mesh, coloring the center mesh point white will create a smooth gradient from that center point outward in all eight directions—up, down, left, right, and toward each of the four corners.
In the Gradient Mesh dialog, choose a suitable number of starting columns and rows. How many you start with depends on the size and shape of your tomato or other object. You want enough rows and columns to easily color the tomato with light, shadow, and different surface colors, but you always want sufficient space between columns and rows that colors will transition smoothly rather than sharply. The further away two mesh points are, the smoother and more subtle the change between their respective colors; the closer two mesh points are together, the sharper the color transition.
Turn on Preview (if it is not already on) and notice that the mesh lines, which comprise the grid, are not perfectly horizontal and vertical; they adapt to the shape of the object defined by its outer path. Thus dimensionality is often already infused into the gradient mesh object.
To follow my lead, begin with 8 rows and columns. Appearance should be Flat and the Highlight 100 percent. Click OK.
The tomato is now a gradient mesh object, with all the mesh points selected (notice that they’re filled or selected rather than empty points). Switch to the white arrow Direct Selection tool and individually select a mesh point, and then change its color by choosing a swatch from the Swatches panel or mixing a new color from the Color panel. To give the tomato its first highlight, select a mesh point near the top left and color it white. If the highlight you get is too small, color other mesh points around the first white.
If the shape of the highlight isn’t exactly what you want, you can move mesh points with the white arrow and even drag their curve handles to reshape the mesh lines attached to them, and thus the direction and depth of their color transitions. Remember, mesh points behave just like anchor points; the only difference is that they also contain color data instead of just curve direction and depth data. You can even use the Convert Anchor Point tool on mesh points to change them from smooth to corner points or manipulate the curvature of mesh lines on either side independently.
If you need more mesh points, switch to the Mesh tool, which is located on the Tools panel between the Column Graph and Gradient tools. When you click with the Mesh tool in a mesh patch, the empty space between rows and columns, you’ll create a new row and column. Clicking the Mesh tool directly on a mesh line, however, will create a row or column—clicking on a vertical mesh line creates a new row at that point, clicking on a horizontal mesh line creates a new column. If you add a new row or column to an area that has already been colored, the resulting mesh points will pick up the colors at the point of insertion.
If you need fewer mesh points, perhaps because colors are transitioning too sharply, hold down the option key and click with the Mesh tool on a mesh point. That will delete the column and row intersecting at that mesh point.
Note that you can also assign color to the mesh points at the outside of your path shape, at the ends of column and row lines. This is how I gave my tomato the backlighting on its right edge.
For larger areas of color, the shadow on the front of my tomato for instance, click with the white arrow (not the Mesh tool) inside a mesh patch. That will automatically select, and enable you to color simultaneously, all four mesh points that define the shape of that patch.
Continue coloring until you’re happy with the result. If you make a mistake, use Command-Z to undo, or just recolor the mesh point; they’re always editable, even after saving, closing, and re-opening the Illustrator document.
When the tomato is done, you can finish it off with leaves and maybe a stem, each of which can also be colored via a gradient mesh.
Believe it or not, the tomato I used for this example took me only 15 minutes to create from start to finish—including drawing the initial paths and adding and coloring the leaves and stem. Initially, your artwork might take longer; but with a little practice, you can quickly create stunningly colored gradient mesh objects.
In part two of this tutorial, which runs tomorrow, I'll outline some easy keyboard shortcuts you can use to accomplish the tasks above.
[Pariah S. Burke is the author of Mastering InDesign CS3 for Print Design and Production (Sybex, 2007), and other books; a freelance graphic designer; and the publisher of the Web sites GurusUnleashed.com,WorkflowFreelance.com, and CreativesAre.com. Pariah lives in Portland, Ore.]
[Part two of this series will run on Thursday, March 4, 2010.]