A Picture Worth a Thousand Points:
To start things off, we need a source image to serve as our template for this gradient mesh image. For this tutorial I’ll be using a light bulb photograph from the stock.xchng. I chose this particular image because it has clearly defined edges, as well as components that the subject it can be separated into. The outline of the light bulb as a whole is crisp. Also, you can easily subdivide the object into several components, such as the glass bulb, the metallic base, and the wire filament. This will make it easier to work with, as you’ll see further along in the tutorial.
After downloading the source image and putting it into an easy-to-find location, open up Illustrator and create a new document that is 768×1024 (I’m using Illustrator CS3). Make sure to open up the Advanced section to make sure that the Color Mode is set to RGB.
After your new document is created, go to File > Place…
Now Place our light bulb stock onto Layer 1 of our canvas. When it’s on the canvas, adjust the height/width of the image so that it better fills the space. With the stock image selected, use the Free Transform Tool (shortcut: E). You can easily and proportionately resize the image by holding Shift+Alt while dragging one of the image corners. This allows you to resize both the height and width proportionately, while the center point remains firmly in place in the middle of the canvas.
Now go to the Layers tab and double click on Layer 1, which is where your stock image should be sitting on. A popup window will appear with the Layer Options. Rename it to “Original”, select the “Template” option, and deselect the “Dim Images…” checkbox.
All Gradients Start Off with a Single Color:
First, create a new layer. Bring up the Layer Options popup for this one. Rename the layer “Bulb”.
Next, use your Rectangle Tool (shortcut: M) and create a rectangle about where the middle of the bulb is. Turn off the outline of this shape, and give it a green fill (0,255,0).
Then, go to Object > Create Gradient Mesh…
In the Popup, give your gradient mesh the following settings.
When that’s done, your green rectangle should look like this:
Now, select your Free Transform Tool again. Use this tool to resize the rectangle so that its top, bottom, left, and right sides line up with sides of the light bulb’s glass part. Then change the overall opacity of the rectangle to 50% so that you can see the bulb through it.
Once this is all in place, take your Direct Selection Tool (shortcut: A) and adjust the outer points of the rectangle so that they line up relatively with the outline of the bulb. As you select these points, you will notice that they have handles attached to them. Use them to adjust the curve of the outlines. Try to make minimal adjustments to the points vertically. Adjust the points by moving them primarily horizontally.
As you can see, there are not enough points to make this shape completely conform to the outline of the light bulb. So we will add some. Select the Mesh Tool (shortcut: U).
After selecting this tool, place the cursor over the edge that you want to modify. Then, when you click on the edge, it will create a new set of points on the gradient mesh. Once those points are created, you can use them to further refine the outline of this shape. Repeat this process until your gradient mesh shape is the same as the outline of the bulb.
Now some of you might be wondering why I chose to create the light bulb shape like this, instead of just by tracing the bulb’s outline with the Pen Tool. Take a look at this 2-row, 2-column gradient mesh I created using a shape I made with the Pen Tool:
This is the shape:
And this is the gradient mesh created from it:
As you can see, when the gradient mesh was created out of this shape, it didn’t use any of the vector points from the original shape when it created the columns and rows. It created its own points on the top, bottom, left, and right sides. Using the Mesh Tool and clicking on individual points will result in a similar issue. It may use the point I selected on the left side, but it will create a new point on the right side to connect to, completely disregarding any other points that might be close by.
So essentially, it’s my preference to use a rectangle when I create the initial gradient mesh because it allows me to make better use of all the vector points at my disposal.
This Shade of Green is Not Very Realistic, is it?
Now it’s time to start changing the colors of this gradient mesh from neon green to something that resembles an actual light bulb. Take your green gradient mesh and restore the opacity to 100%, so that the image is a solid color once more. Then, change the view of the canvas to Outline Mode. You can do this either by going View > Outline or by using the shortcut Ctrl+Y.
Now there are two tools you will be using extensively from here on out: the Direct Selection Tool and the Eyedropper (shortcut: I). Take your Direct Selection Tool and select the vector point in the middle of the bulb.
Then take the Eyedropper and select the color of the background image as close as you can to the vector point. In this case, the color will be white. Now, if you turn off Outline View, instead of the gradient mesh being solid green, there will be a spot of white in the middle.
Turn Outline View back on and repeat the process to change the colors of all the vector points on this bulb. Every vector should be made to match with colors right next to them (with the exception of the several vector points that are along the middle vertical line running through the bulb. Aside from the ones that are attached to the outline, those should be made white, like the initial vector color change illustrated above. We’re ignoring the filament related features of the light bulb for the moment). When you are done, there should not be one spot of green left on this image and it should look similar to this:
In the original light bulb picture, there is a great deal of white in the middle of the light bulb before it starts turning gray. We’re going to remedy this not by adding more vector points, but by adjusting the ones that are already in place. If you take your Direct Selection Tool and select the center vector point, a set of handlebars will appear. They may be hard to see against the gridlines, if they’re perfectly horizontal and vertical like in the image below, but you can tell they’re there by the four dots that end each handlebar.
These handlebars are used to control not only the curve of the gradient mesh lines, but also how far the vector point’s color extends before blending into the color attached to the next point. If you keep the handlebars close to their originating vector point, the color will be strongest only close to the point. If you extend the handlebars out farther, the color will extend further too. If you extend some lengths of the vector point handlebars, and then shorten up the handlebars of the other vector points connected to them, you’ll see how much the colors are affected by these changes. This image is what happens if you shorten the middle vector point’s handlebars, and then lengthen the outer edge vector points’ handlebars…
…And this image is what happens if you lengthen the middle vector point’s handlebars and shorten the outer edge vector points’ handlebars.
Now using the original image as a guide, make it so that the white color of the bulb fills most of the gradient mesh, using just the handlebars. When you’re done, the mesh should looks something like this:
It’s All About the Fine Tuning
Now we have a basic shape and look of the bulb portion of this image. However, we want to make this as realistic as possible. The ultimate goal is to create something that, at first glance, someone would mistake for a photo of a light bulb. So we’re going to have to take a look at the original image again.
Go back to Outline View and let’s take a closer look at the very top portion of this bulb.
As you can see, there are some rather distinct color changes between the edges of the bulb and the white portion of the middle part. So what we’re going to do is create a few new vector points so that we can recreate this more defined gray area. Take the Mesh Tool (shortcut: U) and make a point where illustrated below. Then take the Eyedropper and select the gray color that is right next to point you just made.
Now repeat this action, but this time use the Mesh Tool to create a point right below the one you just made, right where the white/light gray area meets the dark gray. Use the Eyedropper to select the nearby color for this point too.
Now when you go turn off Outline View, you’ll see that there is now a more defined gray area where you made those points.
It looks a little unnatural for the moment, but this will be fixed after we go through and do some more editing. Adjust the handlebars. Add additional points where necessary to the gradient mesh. It will take some time, but in the end you will end up with a bulb that looks like this:
Compare this image with the original light bulb…
Pretty close, isn’t it? Here is a look at what the gradient mesh for the bulb looks like after all my tweaking to make it resemble the original:
As you can see, I created more closely packed vector points and lines around the areas where I wanted to add more detail, which were at the edges and their varying shades of gray. In order to edit some of those points, particularly around the places where they bunched up really closely, I would have to zoom in anywhere from 200% to 800% to be able to adjust the vector point colors and handlebars. That attention to detail, though sometimes time-consuming, will pay off in the end.
Just Because You Can Doesn’t Mean You Should
Let me let you in on a little secret (well not really a secret… more along the lines of common sense reminder). Even though this is a tutorial about using gradient mesh in Illustrator to recreate a realistic image, is that reason enough to make EVERYTHING in the image out of a gradient mesh?
If you can get away with replicating parts of the image using regular vector shapes with creative use of gradient fills, strokes, and other filters provided by Illustrator, then by all means do it! It will save you time and maybe even a little bit of your sanity in the long run when doing gradient mesh images.
Case-in-point: The filament of the light bulb.
The filament of the light bulb is made up of some very thin pieces of metal with even thinner pieces of wire suspended or placed between them. In my opinion, it is not necessary to use a gradient mesh because their appearance can be replicated using some very thin strokes for the wires, and then using some shapes with gradient fills for the metal.
First, turn off visibility of your Bulb layer so that you can see the original photo. Then make a new layer and name it “Filament”. Then zoom in so that you can clearly view the filament portion of the bulb. Turn off your fill color, make your stroke color some bright, non-black/white color, and use your Pen Tool to trace the outline of one of the metal pieces holding the wire filament in place.
Then, with the shape selected, open up the gradients palette and give the shape a linear gradient fill with a .75 pt stroke. The stroke should be colored #0D0D0D, and the fill should be #383838 on the far left, #575757 at 50%, and 1F1F1F on the far right.
When viewed up close, this clearly looks like a flat shape. However, when viewed from its normal dimensions or smaller, it becomes very hard to tell the vector object from the original. Can you tell which is which?
Now, using shapes and lines at your disposal finish building out the filament portion of the light bulb. When you’re done, your partially completed light bulb should look something like this when both the Bulb and Filament layers are visible:
Divide and Conquer
Now that you know the basic for manipulating gradient meshes, all that’s left to do is to finish creating the rest of the light bulb. What you will want to do is to single out specific components of the original image to recreate.
Here is an example of one way could subdivide the remainder of this image. If it’s easier for you, go ahead and further subdivide larger portions of these components into smaller, more manageable pieces. Take your time, pay attention to details, and cut corners where you feel that you’re able to. Also make sure to create a separate layer for each component, so you can keep your work organized.
When you’re done, you should have a gradient mesh light bulb that looks as close to a realistic one outside of an actual photograph or 3D rendered object. In Illustrator, the image may look slightly grainy.
Here is a screenshot of just the gradient mesh of the above image, sans all the colors.
Though it might appear grainy in Illustrator, when you export this image as something like a Jpeg, the gradients become smoother and more refined.
The files used in the creation of this tutorial can be downloaded here: Tutorial files - Gradient Mesh Lightbulb (3701)
Using the techniques taught in this tutorial, one can go about creating many different kinds of realistic vector images using gradient meshes. The techniques used here work best with images of things that can be cleanly divided into segments, such as mechanical devices, automobiles, insects, instruments, plants, etc. It is also very possible to recreate more complex organic objects using gradient mesh, such as birds, fish, reptiles, mammals, and even human beings.
Subject matter like that will be covered in future tutorials at a later date. Till then, I hope that I was able to enhance your knowledge of gradient meshes and Illustrator by another degree.