Articles by: Christina Rivera
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: [download id=”61″]
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.
A Square Foundation
Let’s start off by creating a new document that’s 1024×768. Name this first layer “Maze.” Then, take the Rectangle tool and draw a 50×50 square. Give this square a 10px black outline and no fill. Then align it to the center of the canvas. Repeat this process, only this time make the square 700×700.
Now we’re going to blend these two squares together. Select the two of them and then type Ctrl+Alt+B (or go to Edit > Object > Blend > Make on your menu bar.)
Now you should have what looks like three squares. We want a few more than this, though. So it’s time to go into the Blend Options and make a few changes.
After that’s done, you should have a series of squares that look like this on your canvas.
We can’t do anything with these squares until we separate them into their individual shapes. So go to Object > Expand and make sure all the checkboxes for “Object,” “Fill,” and “Stroke” are selected before you hit the “OK” button. Now the squares are separate items. However, they are still grouped. So type Shift+Ctrl+G to ungroup the lot of them. Now you can select each square individually.
A Proper Maze Has a Lot of Twists, Turns, and Dead Ends
A maze is not a number of squares within each other from largest to smallest. A maze is a puzzle where the solution is a winding path amid many twists, turns, and dead ends leads from the outer entrance to the center. So now it’s time to turn this pattern of squares into a true labyrinth.
Take the pencil tool (Shortcut: “N”), change the stroke color to red, and make the stroke width at least 3pts. Then create a new layer above the squares, named “Solution”. Take the pencil and draw a possible solution to the maze through the squares on this layer. It should start in the center and end somewhere outside the outermost square.
The drawn line does not have to be perfect. Nor does it have to cover the entire square. It can be as simple or complex as you want it, so long as it’s not a straight line from start to finish. After you’ve finished drawing your path for the maze, double click on the “Solution” layer and select the “Template” option. Now we can go back to the “Maze” layer.
We’re going to use two tools to edit the squares on the “Maze” layer. The first tool is the “Add Anchor Point Pen Tool” (shortcut: “+”). The second is the “Line Tool” (shortcut: “/”). Starting with the smallest, innermost box, take the “Add Anchor Point Pen Tool” and add two anchor points on either side of the solution line that crosses through it.
After those two points are added, add one more point between those two. Immediately after that, press the “Delete” key to remove that third point. Now you should be left with a single opening in the center square.
Now take your “Line” tool and draw a line from one side of the small square to the side of the larger square just outside it. Press and hold the “Shift” key while you draw this line to keep it perpendicular to the wall you’re drawing from. This creates your first “dead end” in the maze.
Now it’s just a matter of opening up doorways where the red lines cross the black boxes, and creating walls for dead ends. Don’t forget to create more doorways and walls to create a more complex maze. When you’re done you ought to have something that looks like this:
When your maze is done, select all the black lines on the page. Go up to the “Object” drop-down menu and “Expand” everything. Once everything is expanded, open up the “Pathfinder” tab (shortcut: Shift+Ctrl+F9). Under the “Shape Modes”, press and hold the Alt key while selecting the “Add to Shape Area” button. Any lines that intersected another become a solid shape. Anything not intersecting will be grouped together automatically.
When your maze is fully developed, then you can go ahead and delete or hide the “Solution” layer. It won’t be needed again. Now what you’re left with is the grouped shape on the Maze layer.
Turning the 2D to 3D
Now it’s time to turn this flat maze into a three-dimensional labyrinth. Select the grouped maze image and change the color to gray (#7F7F7F). Then go to Effects >Extrude & Bevel…
When the pop-up menu opens up with all the options, change the settings to what you see below:
If you click on “Ok”, your 3D maze should now look like this:
Adding a Little Flair
For this maze, I want to make it so that the bottoms of the walls blend into the background. In order to do this, we are going to map the labyrinth walls with a simple gradient symbol. On the same Maze layer, create a 100×100 square. Fill it with a gray-to-white gradient (#7F7F7F to #FFFFFF).
With this square still selected, turn it into a graphic symbol by pressing F8. Name it “Wall”.
Now reselect your maze and open up your “Appearance” tab. Double-click the FX layer named “3D Extrude & Bevel”. When the options pop-up has opened up, select the “Map Art” button.
Press the “Next Surface” button on the Map Art options screen until you reach a simple rectangular shape. Whenever you get to a plain rectangle shape go to the Symbols drop down and select your “Wall” symbol. Make sure to press the “Scale to Fit” button.
Note: Although the gradient is mapped to the wall so that the gradient runs white-to-gray from top-to-bottom, when it appears on the actual 3D object, it will be reversed so that it’s gray-to-white.
Keep going through each image and map each visible wall, which are usually shaded in a very light gray. Walls that are not visible will usually be shaded in dark gray and do not need to be mapped. I say “usually” because sometimes Illustrator’s 3D Extrude and Bevel function acts a little buggy with complex shapes like this. Sometimes walls that are visible on the canvas show up as “not visible” in the Map Art pop-up. If you keep the “Preview” box checked, you can see which walls you are mapping on the 3D labyrinth itself as you go. When you’re done mapping all the visible walls, this is how the labyrinth should look:
Now we have the fully built 3D Labyrinth. However, let’s add some color. We want to make all the gray portions blue. This is easy enough to fix, and we won’t have to go into any shapes or symbols to do it. First select the maze and then go to Edit > Edit Colors > Recolor Artwork from your menubar.
If you followed the tutorial to the letter, you should only have two colors available to edit in the Live Color pop-up: white and gray. In the “New” color box beside the gray color, change that swatch of gray to blue. Then press OK. Everything that had that gray color, including the gradient in the “Wall” symbol, will now be changed.
The color is now what we want it. However, I want to see more white in the gradient of the walls. All you need to do to change how the walls look is to open up the “Wall” symbol and change the gradient there. If the symbol is deleted, then it can be found again in the Symbol tab (Shift+Ctrl+F11). Double-click the symbol to open it up for editing. Change the midpoint of the gradient from 50% to 75%.
When you’re done with the color and gradient changes, your maze should look like this:
Finally, it’s time to export the final image. Take a moment to center the labyrinth in the middle of the canvas. Then go to File > Export and export the image into the file-type and resolution of your choice. For this example, I chose a JPEG. When you look upon the final exported image, you’ll notice that the image has no jagged edges around the perimeter of the maze. The white portions of the walls blend smoothly into the background. You now have what looks like a labyrinth sitting in the middle of a fog.
Now that you know how to create this 3D labyrinth, feel free to experiment with any number of shape and color combinations. Variations of this theme can be created using different foundations shapes (circles, hexagons, hearts, etc) and by varying the number of shapes used as well as the thickness of their outlines. If you wish to make the maze large enough so that it fills the entire canvas, I suggest either making the size change before you start mapping the walls (as the symbols do not deform well once they are in place) or exporting the image far larger than your intended image dimensions, and then cropping the image down to the size and view you want.
I hope you enjoyed this tutorial and that it proves useful in a future artistic endeavor.