Illustrator How-to: This Technique is a Real Knockout
One of the things that I really love about Illustrator is that it's used across such a diverse professional spectrum. Before I even joined Adobe, I spent several years training New York City fashion designers in Illustrator. And since then, I've had the pleasure of working with folks at places like Cabelas, Reebok, Victoria's Secret, Hurley International, the GAP, and more. A good friend of mine recently got a job at Nike in Europe and was lamenting how difficult it was to draw certain kinds of stitching lines. Illustrator's Stroke attribute can be used to simulate a stitching line by using the dash setting. You can turn on the Dash setting for any stroke and then assign a Dash setting (the length of each dash segment) and a Gap setting (the length of the space that appears between each dash). There are three sets of dashes and gaps (meaning you can specify a long dash followed by a short dash, etc.), and you can also use Illustrator's various Cap and Join settings to further customize the appearance of your strokes. If you have the Real World Illustrator CS3 book, there's good information on all of these Stroke settings on pages 48-51. My friend at Nike was struggling to create double stitching. Knowing how often apparel designs change, and how newer designs evolve from existing designs, it becomes increasingly important to work with objects that can easily be edited. If you had to draw two paths to simulate a double-stitched line, that would make it twice as more difficult to make edits. The answer to my friend's problem is something we can all use (from version 9.0 on!), even if the nearest we get to the fashion industry is watching Project Runway. Tricks that Don't Work You can create a single path and add two stroke attributes to that path. If you were to create a heavy black stroke with a dash setting and then add a thinner white stroke with no dash setting on top of it, you'd get a perfect double-stitched line, correct? One problem. If the apparel you're designing isn't colored white, you'll have a white area between your two stitch lines. You could set the entire path to the Multiply blend mode, which will make the white go away, but if your stitch lines aren't colored black (for example, you're using green or red thread), that color will also multiply. If your thread is white, the whole stitch will disappear altogether. What you really want is a way to make the middle area between the two stitch lines become truly transparent. That solution exists, and the good news is, the steps are pretty much the same, and you can even define a Graphic Style so that you can apply double-stitched lines with a single click. Knockout Group to the Rescue The secret to making this work is a teeny little checkbox in the Transparency panel called Knockout Group. It's a setting that most people ignore. Few people even know what it does. Let's first learn what it does, and then we'll see how it will allow us to create quick and perfect double-stitched lines (or really anything else for that matter). You probably already know that you can adjust the opacity of an object. So if you have two objects, say a blue circle and a red bar running across it, you can set the opacity of the red bar to 50%. The result would be 50% of red on the parts of the bar that extend beyond the circle. But the part of the bar that appears directly over the blue circle would appear as purple -- or more specifically, a mix of blue and 50% red, correct? After all, that’s what transparency does: It allows you to see “through” the top object and see the object beneath it. If I were to now group the two objects together, I’d be able to move them around the screen, and as expected, I’d see purple in the middle area, and whatever was beneath the logo would appear through the ends of the red bar. If you look at the Transparency panel (fully expanded), you’ll see that the Knockout Group option appears with a line through it. This indicates a “neutral” position, which allows transparent objects within a group to be visible through each other. That’s how you can see the purple area where both the red bar and the blue circle overlap. As expected. This is the default behavior. Below, the Knockout Group setting in the Neutral setting, the On setting, and the Off setting. But let’s say I wanted the red bar to be 50% transparent so that it would interact with objects beneath it, but not with objects that were in its own group. That would mean I’d want to see 50% red in the area where the red and blue overlapped, not purple. By selecting the group and checking Knockout Group, I’m instructing Illustrator to knockout (or remove) the parts of the group that appear beneath transparent effects. In the illustration below, the group on the left is set to the default neutral knockout group setting, while the group on the right is set to knockout group turned on. To really illustrate what’s happening here, I could use the same color for the objects in my group, and use the opacity settings alone to knockout the overlapping areas. Using the same example, I’ll color both the circle and bar black. And I’ll set the opacity of the bar to 0%. So, using the default “neutral” setting, my group would appear as a solid black circle. As expected. But upon turning on the Knockout Group setting, the top object (which is colored black but is set to 0% opacity) will knockout the part of the circle that it overlaps. Since the bar has no opacity, the result is simply a knockout. In the illustration below, the group on the left is set to the default neutral knockout group setting, while the group on the right is set to knockout group turned on. Using Knockout Group -- Without a Group Now that you understand what Knockout Group does, you can use it to create double-stitched lines. The beauty of this technique is that it uses the knockout group setting, but without creating a group. By applying multiple strokes within a single object, you’ll simulate a group within one object. 1. Draw a path with a Fill set to none and a Stroke set to black. Set its weight to 6pt and apply a simple dash setting. I used a dash of 6 and a gap of 4. 2. From the Appearance panel flyout menu, choose Add New Stroke. 3. Keep the stroke black and change its weight to 4pt. Turn off the Dash setting for this stroke and choose the Projecting Cap option in the Stroke panel. This will ensure that the ends of the stroke appear without artifacts of the dash beneath it. 4. Change the opacity of the top-most stroke to 0%. It’s important to remember that you can’t apply the knockout group to one attribute (as it won’t do anything), so you need to make sure that we apply it to the entire object. That's why the next step is so important. 5. Click on the word “Path” in the Appearance panel. This ensures that you’ve targeted the entire path object and not just one of its stroke attributes. 6. Turn on Knockout Group in the Transparency panel. You’ll actually need to click on this option twice: the first time sets the object to the neutral setting, and the second time turns on the knockout setting. The result will be a stroke that appears to have a double stitch. The top-most stroke knocks out the bottom one, giving you true transparency in between. Now you can tweak the weights of the strokes, the dash settings, and the colors of the strokes as needed. Once you’ve finalized the look of your stitching, drag it to the Graphic Styles panel to save it as a style. Now you simply apply the style to any path and you get instant stitching! Create a variety of different stitching patterns and create styles for them all. Save them as a Graphic Styles library and you’ll suddenly become the most popular person in your design group. Note: If you think I'm so smart that I know all this stuff on my own, think again. I was first introduced to the knockout group setting by Pierre Louveaux, and Teri Pettit expanded on that. Both Andrew Dashwood (the one who originally asked the question about the double-stitching) and Jean Claude "JC" Tremblay contributed to this article as well. The author of Real World Illustrator CS3 and the Real World Illustrator Blog, Mordy Golding can also be seen at upcoming events and seminars from MOGO Media.