Accessibility

Design Center Tutorial

Look behind the mask in Illustrator CS2

Mordy Golding

Mordy Golding

 

book cover

www.adobepress.com

 

Created:
08 Sep 2006
User Level:
Advanced
Products:
illustrator

When we refer to masks, we’re not talking about the kind you wear to Mardi Gras. Masking in Adobe® Illustrator® is a way to define parts of your artwork as being hidden from view. Rather than having to delete unwanted parts of your art, you can use a vector shape to define an area that acts like a window: Anything that appears within the borders of the shape is visible, and anything that falls outside its boundaries is not visible. The main benefit derived from using masks is that you aren’t deleting anything from your file, and once a mask is created, it’s possible to change the mask or the artwork behind it, as well as reposition the mask to show or hide different parts of your artwork.

When you use masks in a file and are required to make changes, you’ll never have to re-create art that you’ve already deleted. Instead, everything that you create is always in the file, and you simply choose what is or isn’t visible. Additionally, a mask allows you to instantly clip parts of an image or an object. By using a mask, you can do with one click what might take tens of clicks if you use pathfinder functions to chop up and delete parts of objects.

There are three different kinds of masks that you can create in Illustrator, each with its own benefits. A clipping mask allows you to specify a certain vector shape as a mask for other individual or grouped objects. A layer clipping mask allows you to specify a certain vector shape as a mask for all the objects within the same layer. An opacity mask allows you to use the luminance value of any object to create a mask for other individual or grouped objects. As you will see, this last type of mask—one of the most well hidden features of Illustrator—is also the most powerful.

Create clipping masks

A clipping mask can be made up of any vector object, including editable text. To create a clipping mask, you select both the path that will be the mask and the art that you want to appear inside of the mask. The path that you want to use as the mask must be the topmost object in your selection. Choose Object > Clipping Mask > Make, and only art that falls within the boundaries of the mask object will remain visible (Figure 1).

all objects selected

Figure 1: Before creating a clipping mask, the objects are all selected (left), and once the mask is applied, the topmost object defines what is or is not visible for the remainder of the selected objects (right).

Note: A clipping mask uses the vector path as the boundary for the mask, even if the object has an appearance applied to it.

When Illustrator creates a clipping mask, the mask and the art are grouped together, making it easy to move them around as a single unit when you’re using the Selection tool. However, you can use the Direct Selection tool to select and edit just the mask, or just the artwork independently. In truth, because the masked art is still selectable, it can make life difficult when you have a lot of masks in a file, because you can easily select masked artwork when you don’t intend to do so. At the same time, this behavior does make it easy to edit artwork within masks. Getting into the habit of using the Layers palette to lock the art that you aren’t working with for a particular task helps avoid this.

Organize masking with layer clipping masks

A layer clipping mask is very similar to a clipping mask, with one main difference: instead of masking another selected object or group of objects, it masks entire layers. In reality, layer clipping masks are far easier to control and work with because you aren’t constantly selecting and deselecting objects to define what is or what isn’t in a particular mask. Instead, you use the Layers palette, which you use to organize your artwork anyway, to create these kinds of masks.

To create a layer clipping mask, place the vector object that will be your mask at the top of the layer’s stacking order. Click once on the layer name in the Layers palette, which selects the layer (you don’t want to target the layer, just select it in the palette). Then, click the Make/Release Clipping Mask icon at the bottom of the Layers palette (Figure 2). The topmost object in your layer now becomes a mask for all objects in that layer. The mask appears listed in the Layers palette with an underline, giving you a visual indication of its behavior (Figure 3). With layer clipping masks, you can easily drag items into a masked layer to have them affected by the mask, and vice versa. To release a layer clipping mask, select the layer and click the Make/Release Clipping Mask button.

layer clipping mask

Figure 2: If you see something listed in the Layers palette with an underline, you know that object is clipping mask.

layers pallete

Figure 3: To create a layer clipping mask, select the layer first, and then define the mask.


See through objects with opacity masks

When you’re creating clipping and layer clipping masks, the vector path of the mask is what defines the boundary of what is visible and what is not. Additionally, anything that falls inside the mask area is completely visible and anything that falls outside that area is completely hidden. Opacity masks bring a whole new level of functionality to Illustrator because in addition to using the vector path itself as the mask, the visual appearance of the mask is what defines what is shown and what is hidden.

If you’ve used Adobe Photoshop® before, you’re familiar with something called an alpha channel. In reality, an alpha channel in Photoshop is just like a mask, where the color black represents areas of the image that are visible and the color white represents areas of the image that are hidden. With an alpha channel, however, you can also specify a color of gray, which translates to part of an image that’s partially visible. In fact, alpha channels support up to 256 levels of gray, which translate to up to 256 levels of visibility in such a mask. Because of this functionality, users can specify masks with soft edges and fades when they use Photoshop. Each pixel of the mask can represent a different opacity value. Opacity masks in Illustrator can take advantage of that same functionality.

When you use an object as an opacity mask, the vector path is not the only thing that determines what it shown and what is hidden—the visual makeup of the object is what determines the mask as well. Opacity masks support 256 levels of gray, meaning that you can create a soft-edged mask in Illustrator. Let’s see how this works by using a gradient as an opacity mask.

Create an opacity mask

For this exercise, imagine you want to create a gradient that fades from 100-percent color to none (which is not currently possible as you can’t assign the None attribute to a color stop in a gradient). Begin by creating a rectangle and fill it with a solid color. Next, select the rectangle and copy it by pressing Command-C (Ctrl-C). Now paste it in front of the first rectangle by pressing Command-F (Ctrl-F). Fill the second rectangle with a regular black to white linear gradient. You now have two objects, stacked on top of each other, with the gradient visible on top (Figure 4).

2 stacked rectangles

Figure 4: Two rectangles stacked on top of each other, and only the one filled with the gradient is visible.

Use the Selection tool to select both objects and open your Transparency palette. In order to create an Opacity mask, you have to expand the palette to show all of its options, so click the triangles to the left of the Palette tab or choose Show Options from the palette menu. You will see a thumbnail of your selection in the Transparency palette (Figure 5). Finally, choose Make Opacity Mask from the Transparency palette menu. The result is a mask that uses the values of the gradient to define what parts of the object are visible below it—an object that effectively fades from 100-percent color to transparent (feel free to create an object that appears beneath the rectangle if you don’t believe me).

Transparency pallete

Figure 5: A thumbnail of your selected art is visible in the Transparency palette.

Edit an opacity mask

Once you’ve created the opacity mask, you can use the thumbnails in the Transparency palette to work with both the mask and the artwork beneath it. Instead of one thumbnail as you saw before, there are now two thumbnails: the one on the left is the artwork, the one on the right is the mask. To edit the artwork, click the left thumbnail. If you look at your Appearance palette, you’ll notice that the object you have selected is a normal path that has a solid fill attributed to it. The name of the path displays with a dashed underline in both the Appearance palette and the Layers palette, indicating that it has an opacity mask applied (Figure 6). At this point, the mask itself is not editable, nor can it even be selected.

opacity mask icon

Figure 6: A target with a dashed underline quickly identifies an object that has an opacity mask applied to it.

Clicking the Invert Mask button reverses a mask and, rather than having the color black appear as transparent, the color black represents areas that are opaque. The Transparency palette menu also has an option to set all new masks to be created so that they are inverted.

Clicking the right thumbnail selects the mask, allowing you to edit its attributes (Figure 7). Take a look at the Layers palette; doing so reveals something very interesting. Instead of displaying all of the layers and objects in your file, when you click the mask thumbnail, the Layers palette switches to display just the opacity mask (Figure 8). The title bar of your document also indicates that you are editing the opacity mask and not the art. These visual indications help you easily identify when you are editing art and when you are editing an opacity mask. To return to artwork editing mode, simply click again on the left thumbnail icon.

clicking a thumbnail

Figure 7: Clicking a thumbnail in the Transparency palette tells Illustrator what you want to edit. A black outline around the thumbnail indicates which one is selected.

the layers palette

Figure 8: The Layers palette offers a visual cue to indicate when you are editing an opacity mask.

When you are editing either the artwork or the opacity mask itself, using the selection tool to move items will result in both the artwork and the mask moving together. The reason for this is that by default, a mask and its artwork are linked with each other, indicated in the Transparency palette by a link icon that appears between the two thumbnail icons (Figure 9).

Clicking the link icon allows you to move the mask and artwork independently of each other, and clicking between the thumbnails toggles the link behavior.

clicking the link icon

Figure 9: Clicking the link icon between the thumbnails allows you to move the art and the mask independently.

Featured match-up: clipping masks vs. opacity masks

When do you use an opacity mask instead of a clipping mask? One certainly doesn’t replace the other, because each mask has specific benefits. A clipping mask uses the actual path of the vector object to define the clipping area. This means a clipping mask always has a hard vector edge. In contrast, an opacity mask uses the actual appearance of a shape as the mask, meaning that you can create masks with soft edges or different levels of opacity. Additionally, opacity masks are controlled via the Transparency palette, making it easier to choose when you want to work with the mask or the artwork behind the mask. Of course, using an opacity mask means that you’re using transparency in your file, which requires flattening. When you’re creating files for certain workflows that become complicated when you use transparency effects, using a clipping mask is beneficial.

Take opacity masks to the next level

Because opacity masks are “hidden” deep within the Transparency palette, they are a feature that doesn’t get much publicity. However, they are really one of the most sophisticated features you’ll find that offers a wide range of functionality. If you truly understand that opacity masks are just levels of gray that determine visibility, you can use these to achieve effects that you once thought were only possible in Photoshop. Take photographs for example. By using a vector object with a Feather live effect applied to it, you can create a soft-edged vignette for a placed photograph right in Illustrator. Additionally, you can use placed images themselves as an opacity mask, which opens the door to creating Photoshop effects like mezzotints and halos (Figure 10).

mezzotint effect

Figure 10: In this example, a mezzotint effect was applied to an object that was then used as an opacity mask for some type. The result is fully editable type that has a roughened appearance.

About the authors

Mordy Golding has been a production artist for print and the web for many years, and is an Adobe Certified Expert and Adobe Certified Print Specialist. At Adobe, he was the product manager for Illustrator 10 and Illustrator CS. A popular presenter at Macworld, Photoshop World and other worldwide events, Mordy is also the author of several books, including SAMS Teach Yourself Adobe Creative Suite All in One, The Web Designer's Guide to Color, and SAMS Teach Yourself Adobe Illustrator in 24 Hours. In 2003, Mordy was named a Champion of Graphic Design by Graphics IQ. Currently he serves as the founder of DesignResponsibly.com, teaching designers and printers how to successfully adopt today's new technology. Mordy is also the author of the Illustrator CS2 and Flash 8 Integration video training title published by lynda.com.

Excerpted from“Real World Adobe Illustrator CS2” by Mordy Golding © 2006. Used with the permission of Peachpit. To purchase this book, please visit adobepress.com.