January 17, 2006

The Beauty Behind the Mask

If you've ever seen Phantom of the Opera, you know that the phantom wears a mask to hide his ugly appearance, yet it's the beauty inside of him that is revealed at the end. A recent thread on the Illustrator User to User forum plus other comments I've seen with regards to a seeming struggle with how masks work in Illustrator have lead me to post this description of how masks can be used to complete an illustration. This example also showcases some of the unique strengths of layer clipping masks.

The goal of this exercise is to use masks to hide portions of individual elements within an illustration, as well as an overall masks to clip the entire complete composite. Of course, the file contains layers and the use of layer clipping masks will allow us to preserve this layer structure.

1. In step one, I show a placed image of the skyline of a city. I'd like to add a different sky and also throw in some effects like spotlights in the sky. To do so, I've drawn a vector path that I will use to clip the buildings from the sky. You can see the path, sitting above the image in the layers palette.

2. In step two, I highlight the skyline layer (remember, layers always have gray backgrounds in the layer palette -- white backgrounds are objects) and toggle the mask (by clicking on the icon in the lower left of the Layers palette). This effectively clips the sky out of the illustration. It affects only the image on this layer. The path appears with an underline in the Layers palette indicating that it is now a mask for the contents of its layer.

3. In step three, I turn on a layer which contains a gradient that I've drawn which I will use as the new sky. This layer appears below the image and so the buildings meet the sky nicely.

4. In step four, I turn on a layer which contains spotlights in the sky. These rays are filled white and have a gaussian blur and have an opacity setting applied. Again, because this layer sits below the image, the rays disappear behind the buildings.

5. In step five, I turn on the text layer, which shows the type that has a drop shadow applied (all together now "because I can").

6. In step six, I prepare the file so that I will be able to apply an overall mask. At the top of my document is a layer which I've called Overall Mask. This layer contains a single path which is the final size of what my artwork needs to be. Selecting all of the layers except for the overall mask layer, I drag them all into the overall mask layer, effectively making them sublayers. These sublayers sit beneath the path which will eventually be used as a mask for the overall mask layer.

7. Finally, in step seven, I highlight the overall mask layer and turn on the mask for that layer. This clips all of the artwork in the file, yet the layer structure remains intact. All elements are completely editable and are easily accessible in the Layers palette.

By the way, you'll notice than in this exercise, I use layer clipping masks twice. In general, I try to stay away from using the Object > Clipping Mask > Make command, because it could result in a loss in layer structure (in reality, it works similarly to layer masks, but when I'm using layer masks, I am more conscious of how I set up my layers and therefore avoid such pitfalls).

I hope this example shines some light (pun intended) on how masks can be used in Illustrator.


Jean-Claude said...

Great step by step little tutorial to demo how to use Layer Clipping Mask to preserve Layer hierarchy...

One thing people must do carefully (even avoid completely) is to not use the Release Clipping Mask at the bottom of the layer palette to release the top layer. Because it will release ALL layer clipping mask underneath nit just the top one. It's probably a bug...
Instead select the clipping mask and use the menu command Object > Clipping Mask > Release.

Also, instead of manually placing the layers manualy into a master layer, you can just select all you layer you want to place into a new layer and use the Collect in New Layer command found inthe Layer palette option...

Michael H. Phillips said...

A very fine tutorial, Mordy.

Teri Pettit said...

Nice little demo, Mordy.

Do a few more of these and I'll be able to just link to your relevant blog entry in response to a lot of the "how do I do it" questions on the User to User forums.

Newmango said...

Good job, Mordy. Next time this issue comes up in the Forum, I'll know where to send them for a clear and concise explanation.

You say, "These sublayers sit beneath the path which will eventually be used as a mask for the overall mask layer." This should be emphasized, because when you turn on the mask for the layer, it looks for the topmost path to use as the mask. If there's a sublayer containing several paths, for example, above the path you want to be the mask, you'll get unpredictable results.

Teri Pettit said...

Right. One of the most frequently encountered misunderstandings about Layer masks (and other Layers palette commands like Collect in New Layer or Release to Layers) is that many people expect them to operate on the object selection, not on which layer is highlighted in the palette. So they get confused when the two selection notions don't coincide, and they don't get the results they expect.

All of your steps are perfect, but I can't count the number of times people skip or alter some step of a step-by-step, thinking it doesn't matter. So I tend to try to predict any possible departures and cut them off at the pass.

Ed Hazel said...

Thanks for the step-by-step guide I've been really struggling with layers and mask, as a newbie the photo editing terminology tends to easily confuse me.

Clipping Path Service said...

completely clear instructions! Thanks for this great tutorial Mordy.