Want a free year on Tuts+ (worth $180)? Start an InMotion Hosting plan for $3.49/mo.
Creating a Gradient Mesh from a rectangle or an ellipse is pretty easy and straightforward. When you have to work with an acutely curved shape, it becomes much more difficult. Here's a technique that will do the trick, and save you from frustration!
What Doesn't Work
We'll use this image from PhotoDune as a reference, and focus on the cup handle.
If you were to start by tracing the outline of the handle, then going to the Object menu to Create Gradient Mesh, the results would be unwieldy. You'd spend way too much time trying to wrangle the mesh lines into place and adjust the color. The mesh lines that hang outside the shape won't prevent your illustration from printing or exporting, but they're a huge hassle to work with. As you can see, simply using Create Gradient Mesh is not a workable solution.
The White Rectangle Technique
Take the Rectangle Tool (M) and draw a rectangle the same height as the base of the handle. We'll eventually bend this rectangle to conform to the shape, so try to imagine how long the handle would be if it were straightened out, and make the rectangle about that length. Make sure it has a fill of white and a stroke of none.
Now with the rectangle selected, go to Object > Create Gradient Mesh. Enter 1 row and 1 column, and choose Flat as the appearance.
Create a new layer for the rectangle. Lock the source image layer and put the new layer into Outline mode by Command-clicking (Windows: Control-click) on the eyeball in the Layers panel. Your artwork should look like the image below.
Take the Direct Selection Tool (A) and move the left points to align with the base of the handle. Do the same with the two right points. This will be a little trickier, and you'll have to adjust the mesh handles as you go, to get the rectangle's edges out of your way. It's best to do it in increments – don't try to do it all in one step.
Depending on the shape you're working with, it may help to add a couple of anchor points along the curve. These are not mesh points, but "helper" points that you can add using the Add Anchor Point Tool (+). You can now select these points with the Direct Selection Tool and use them to help define your shape. This can be a little time-consuming, but be patient and keep working with the shape to get it to conform to your source image.
Remember that the left two points of the original rectangle are aligned with the bottom base of the cup handle, and the right two points have curved around and will align with the top of the handle's base. Take your time: it's better to spend some time up front getting the shape exactly right, before you start adding color to it.
Once the outline shape is done, start adding mesh lines to the interior of the shape. Take the Mesh Tool (U) and click on the left edge of the mesh object (the rectangle/cup handle). This will add a mesh line that follows the curve of the shape. Continue adding as many new mesh lines as you think is necessary. Use the color gradations in the source image to plan where you'll need lines of different colors.
If the mesh lines start to get a little crowded, you can adjust their handles as you go using the Direct Selection or Mesh tools. To remove a mesh line, hold down the Option key (Windows: Alt), hover over the line you want to delete until you see a minus sign on the cursor, and click to delete.
Using the Mesh Tool, click on any of the mesh lines you just created to add mesh lines that are more-or-less perpendicular to the existing mesh lines.
Now that you have the foundation of your irregular shape, you can proceed to sample colors and adjust the transitions as you would normally. The finished cup handle is below.
Now You Know!
Drawing rubber balls and grapes with gradient mesh is relatively easy. If you want to improve your mesh skills, challenge yourself with multi-surface objects. By breaking an object into its component parts and using the white rectangle technique, you'll be on your way to Gradient Mesh mastery.