February 10, 2008

TECHNIQUE: Stitching Lines for Apparel

One of the things that I really love about Illustrator is that it's used across such a diverse professional spectrum. One of the really exciting creative fields that has always drawn my attention is that of fashion and apparel design. Before I even joined Adobe, I spent several years training fashion designers in NYC. 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. It's one thing to design a cool brochure and flip through the pages when it's printed. It's an entirely different experience when you design something and then when it's done, you actually put it on and wear it :)

I should probably write up more stuff on apparel design only because Illustrator has so much to offer in that field. So for now, we'll start with this one. 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. We all know that Illustrator's Stroke attribute can be used to simulate a stitching line by using the dash setting. I'm sure you're all familiar with it, but just in case, 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 actually 3 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.

The question that my friend at Nike was struggling with was creating double-stitching. Obviously, you want to be able to create stitching lines that are easy to create and easy to edit and manipulate. 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 one had to draw two paths to simulate a double-stitched line, that would make it twice as more difficult to make edits.

Anyone who knows me, can probably guess that my answer will involve the Appearance panel, right? Well, most people are probably smart enough to know that 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 in 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. And the good news is, the steps are pretty much the same, and at the end of the day, you can define a Graphic Style so that you can apply double-stitched lines with a single click. In reality, if you are an apparel designer, you should have an entire Graphic Style library of stitching lines alone.


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).

We already know that you can adjust the opacity of an object, right? 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 the 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 we 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 my group, using the default “neutral” setting 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.


Now that we understand what Knockout Group does, we can use it to create our 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, we’ll “simulate” a group within our 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 we can’t apply the knockout group to one attribute (as it won’t do anything), so we need to make sure that we apply it to the entire object. So the following step is 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 will turn the knockout setting on.

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.

At this point, I think you have all that you need. 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 further upon 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.


David Harper said...


I worked this example: fantastic! Cannot get enough of the appearance panel. (yes, we do think you are smart). Since my copy of your RW illustrator CS 3 is dog-eared, plz keep these coming :)

Can I put in a vote for more examples of cool text effects (I have totally abused examples in your book; e.g., 3d + extend). Thanks, David Harper @ bionicturtle.com

Anonymous said...

Interesting solution...

I would have likely solved this by creating a pattern brush. You could just draw out 2 small parallel lines and drag it into the brushes panel. Then just set the spacing as desired.

Unknown said...

YES! A Pattern brush would also be a great solution! But then I wouldn't have gotten to explain what Knockout Group does :)

In reality, a Pattern brush could do a heck of a lot more than the technique shown in this example. For example, I'm often asked how to create a stitch pattern where one side is dashed but one side is solid. Even better yet, Pattern brushes can do amazing things with lace, complex stitching, and other specialty items and materials (i.e., zippers). If anyone would be interested in seeing techniques that cover those items, let me know.

Anonymous said...

Hello Mordy,

I truly appreciate the knowledge you freely share. Your presentation makes it a lot of fun to read. YES! I would really like to learn more about using illustrator in the Apparel industry. There is not much practical infomation around. Especially on stuff about doing the amazing things you mention... lace, complex stitching and more.
Yep, plz keep these tips coming!

Anonymous said...

I loved doing this Mordy and I would really appreciate seeing techniques covering lace and complex stitching.

Gary Spedding, Ph.D. said...

Seems printing and fabrics are in this week. Your essay here and a couple other podcasts and items. Also check out thislink: http://www.computerarts.co.uk/tutorials/2d__and__photoshop/getting_printed_all_over - for a fabric printing tutorial (In Illustrator despite the appearance of PS in the link title).

Anonymous said...

how about selecting the pen tool draw the line you like add some sroke with weight like 8pt and at the object menu select the outline stroke command.from that point you have your original object fill and stroke check your dashed line to creat the stitching lines Nike always wanted.hehehehehe
thank you!

Anonymous said...

Hi Mordy-
Will definitely love to see more tutorials for the fashion industry I have a lot of pattern brushes that I have created, some that I've gotten from friends, but I've never really tried graphic styles and I will start using that for my fashion collection. But love to see more for the apparel industry like making lace and creating patterns, especially irregular patterns, this I don't know how to do yet, no matter how much I've try. Thanks!!!

Anonymous said...

Good technique! Thanks for sharing it :)

Anonymous said...

Is it not easier to draw your dashed line duplicate it in the appearance panel and apply an offset path effect? Seems easier to me!

Thanks for the great blog the knockout group info is useful stuff!

Anonymous said...

The Offset Path effect applied to an open path pushes it in on either side of the path. So, you would only need one dashed stroke with that effect to get the double line. Downside is that the dashes aren't perfectly parrallel as the line curves and the ends may look odd. You may have meant Effect: Transform and then adding a copy offset some distance, but that doesn't line up well either when the path curves. I like Mordy's way.

dieu said...

Help me! I use English not very well so i don't understand what you say, but i want to learn about this lesson, can i see your video lesson.
my address: dieuthuyspkt@yahoo.co.uk
thanks a lot.

Kelek said...

Your blog is now on my favourits. I'd notice but never understand how works that knock-out stuff, even i was made some practice and nothing. Now i understand it very well. Thanx for your sharing!
Muchas gracias amigo!

LTD said...

For authentic looking straight stitches (have you ever seen a curved stitch?) I recommend text on a path. Draw you path and convert it to a text path. Type the = sign a dozen or so times. Select your font, point size, colour. Adjust tracking, baseline, horizontal scaling, etc. When it looks right select all the text, copy and paste until the path is full.

Bryan said...

Came via your comment on Veerle's post on a similar technique.

Very informative, thanks!

Eric Schmider said...

Help - OH HELP!
I work for an apparel company, and we are trying to use a stitch pattern in Illustrator that looks like a zig-zag, or a bunch of san serif w's strung together. The problem is when it goes around a letter with angles like an "N". The "v" pattern gets messy if we use a brush.

Tim said...

All this time, I've never used it or tbh really understood/knew what it did. Wonderful! Thanks!