Splitting Channels to Create a Tree

Finding a Channel to Serve as a Mask for Compositing an Image

by Clifford Anderson

Before we start there is a batch of files to download you'll want to use for this exercise. I will refer to them by name when they are needed.

As you can see from the finished example, above, we will be creating a tree-like effect within a night scene, complete with grass and shadows. This exercise is reasonably open-ended in that, throughout you will be able to add any touches you might like and still be able to complete the project according to spec.

To start, open 'tree_original.tif' from the downloaded files, set the Color Wells to their default, and have the Objects, Channels, and Brush Settings Dockers ready.

The Image Split to Channels
figure 1 : Document Split to Channels, CMYK

Splitting Channels is a convenient way to isolate color information as an independent grayscale document by which we can use/reuse as a channel, mask, or object. Once channels are split they have no color information in and of themselves; they are grayscale documents and can be saved independent of the file from which they derive. That is the general direction that we will be taking here : to extrapolate a nice rendition of this small tree according to grayscale, touch it up with a handful of tips using brushes, then loading it as a new selection into a new document to finish it out.

To determine which channel to choose, your mother's advice is still the best...shop around. Look at your Channels Docker in various Image Modes to see which will best suit your needs. Our need? To get one of the channels to be a close runner-up for the end result : white info = not masked, black info = masked. This will serve well the black/white characteristics of an alpha channel...our goal.

We are starting in RGB (this image), so go to the Channels docker and click on each channel - one at a time - to see the tone of each. Given the heavy amount of gray in this image overall, there isn't a lot to choose from when determining which one would work best for our needs. Therefore, we move on.

Switch the image mode to CMYK (Image | Mode | CMYK); go back to the channels docker and click through them all.

Black channel looks pretty good, doesn't it? We will still need to work with it to reduce it down to the center tree, but it's by far the most contrastive of all the channels so far (lots of white, lots of black; all in the right places). Therefore, we split according to CMYK.

Go to Image | Split Channels | To CMYK. Four additional images will come up, each with a tentative name in the title bar, according to the channel from which it derives (figure 1, above). Seeing this, please note also that each of these new creations are 8-bit grayscale; they have no color information whatsoever.

Close all the documents without saving any of them (including the original color document) *except* for the Black Channel. Save this one under the name, 'tree_channel.cpt', and let's have a short discussion regarding what we need to do with this document.

The Initial Black Channel
figure 2 : The Split Black Channel, Modified with Freehand Mask tool

Our goal is to create a channel as a separate document. This 'channel' is going to be the tree in the center. Therefore, this image we're about to create will end up as a pure white tree against a black background. There are several tricks to getting there. I'd like to introduce you to a few.

Start with the Freehand Mask tool ('K'). Draw an irregular, very generic mask around the center tree. Don't even concern yourself with selecting any part of the tree; just a general area around it. When you're done, press 'Ctrl Sh I' to invert; then press 'Sh Delete' to fill with white (assuming your Paper color is white) and remove the mask (Look at figure 2 for a general idea).

figure 3
figure 3 : Image | Transform | Threshold

Move on to Image | Transform | Threshold (figure 3). This will quickly reduce our image closer to our goal of black-white info but not quite. Therefore, go to Mask | Color Mask... and take a look at figure 4. Double-click on the first available 'Color' chip to address the document's color space.

Please note here that we are in 8-bit grayscale so all we have is the grayscale slider, or Lightness measurements.

figure 4
figure 4 : Mask | Color Mask

Make sure 'White' is selected, click OK to return to the Color Mask dialog, change the Tolerance ('N' for 'Normal') to 30, and finish off according to the figure. This approach will help chip away some of the extra black elements we don't want while keeping the stuff we do. Just another step in trying to reduce the amount of time spent touching things up with brushes.

Now that the background is selected, open the Fill dialog and fill it with white. Invert the mask ('Ctrl Sh I') and fill again but with black; remove the mask. Save your work.

figure 5
figure 5 : Progress so far...

Figure 5 shows how your work should be looking (reasonably). We got most of the work out of the way but quite honestly, the difficult part is still up ahead. Let's consider a strategy :

At this point I would like to make it known that you do have the finished grayscale image in the download I made available for this exercise ('tree_channel.gif'). If you wish to forgo the procedures for getting this document up and running, simply skip down to the section that begins with "Opening a new document."

figure 6
figure 6 :
Initial Brush Settings

In looking at figure 7 and comparing it with figure 5, the task at hand is to invert the image (Image | Transform | Invert), get rid of what we don't want then simplify the rest. Once the inversion is complete, the brush for doing the rest is very small and simple (i.e. no feathering or anti-aliasing, figure 6).

I should like to mention here an issue regarding working in black and white on screen. I'm having you invert the image first, then going about the business of brushing away the pixels you don't want. This means staring at your monitor in a predominantly black environment. If this is irritating to you by all means wait until you're done painting then invert. For some (myself included), painting black branches against a white background is easier on the eyes.

The important things to note here are, however you end up strategizing, keep it simple. For example, one of the purposes for such a rough brush is that branches are not smooth lines; they're jagged, they jumped and jag here and there. They don't promote perfection or a 'one size fits all' approach; their paths are as unique as our own fingerprints. Therefore, allow the brush to promote such serendipity; have some relaxing quiet time with this and have fun.

In the meantime, here is my personal take on how I got it down to figure 7 :

figure 7
figure 7 : Trimming and Fine-Tuning the Black Channel Mask

Once you are satisfied with your work, give it a save. Remember, if you want to open the supplied, finished file to compare and get ideas, it is at your disposal.

Our next step to getting this tree just right is to create shadows to gain a sense of one branch being behind another. If we don't, the result would look like a bunch of lines simply intersecting each other on a flat plane (figures 8 & 9, below).

figures 8 & 9
figures 8 & 9 : Tree Section Before and After
Incorporating Shadows

The settings for brush are simple : 2-3 pixels for nib size, 60% feather.

In general, I used the width of the branch I wanted in front as the guide for how wide I would create the brush nib to produce the shadow. That is, if the branch width is 4 pixels, I created a shadow/gap of 2-3 pixels. Matched with the small amount of feathering the soft edge will produce, it turns out to quite effective.

Remember...you've got the finished copy of this tree/channel so feel free to evaluate and compare if it serves you.

Figure 10 (below) gives some of the detail up close to allow you to scrutinize your options while considering the following. Consistency is a factor when creating the shadows; i.e. follow the branch you are working on from the bottom, up. If you are creating shadows for it that initially place it in front of adjacent branches, keep it in front throughout its length; it follows that, if you want it to slink from front to back in between smaller branches, you can do that also. The only issue is...be consistent.

figure 10
Figure 10 : Using red to detail the consistency you will be after

Now we're to the point to use the image as a mask/selection. Save your work, close the image.

Open a new document with the same dimensions as the original tree document (1280w x 960h x 72 dpi), black for the background color.


Figure 12 :
Highlight & Shadow
Clipped to Parent

If you've never used an external document as a mask, it is a painless operation. Go to Mask | Load | Load Mask From Disk... From the dialog box, open your tree_channel.cpt (or the *.gif I provided) then click anywhere on your new document. Your tree as marching ants should appear.

If ever you don't want to use a 1:1 aspect for a mask, clicking and dragging to the size that you want is the ticket.

Save this mask as a channel, calling it 'tree'. From here, we're going to make three of these 'trees', give them each a different color, then blend them effectually.

Add a new Object (Object | Create | New Object) and fill the mask with 40% black; remove the mask. (At this point, we'd do well to save our document ['tree.cpt']). Duplicate ('Ctrl D') this object twice for a total of three trees. Rename each - from top to bottom - 'tree_shadow', 'tree_highlight', and 'tree_base' (figure 12).

figure 13
Figure 13 : The 3 Objects
Clipped Together

Select the 'tree_shadow' object, fill it with R204 G136 B68; nudge the object up 3 pixels and right 4. Add a Gaussian Blur @ 2.0 to it.

Click on the 'tree_highlight' object and fill it with R105 G70 B35; nudge it 1 pixel left and up then Gaussian Blur it @ 1.2 radius.

Finally, set the Merge Mode @ Opacity of 'tree_shadow' to 'Subtract @ 70%' and 'tree_highlight to 'Add @ 80%'.

Clip both these objects to the parent, 'tree_base' (figure 13), then hide them and select the 'tree_base' object.

Our scene is going to be set at night. The lighter brown will be emulating a light source (upper right), followed by the obvious shadow effect (darker brown and grays, bottom left). These objects, therefore, need to be darkened but as a blend for continuity. What is more, this tree needs some form of texture. Both of these issues are the focus of the 'tree_base' object.

figure 14
Figure 14 : Textures Added

To add a texture, please apply the following effects to the 'tree_base' object :

All that should propose an interesting dance between lights and darks, eh (figure 14)? Select all three tree elements and combine them ('Ctrl Alt DnArr'); rename the new object 'tree' and save.

And that about wraps up the tree object. Next, we move on to giving our centerpiece a context. We'll add some visual clues to give depth to our image that will provide our tree with a spatial relationship with its fore- and background. To do this, we will be adding three distinct objects : sky, horizon, and grass...lots of grass.

figure 15
Figure 15 :
'Sky', 'Horizon' Objects

Select the background, press 'R' for the Rectangle Mask tool and set the Mask Style property to 'Rows' @ 550 pixels. Click and drag until the top of both mask and document meet; 'Ctrl UpArr' to copy to object. Rename 'sky'.

We'll add some stars to the sky in a bit. Right now I'd like to move onto the horizon. Why? It will serve as a visual marker when defining our stars, just as the 'sky' object will now define our horizontal "point" for the 'horizon' object.

figure 16
Figure 16a-f :
'Horizon' object, in steps

To create the 'horizon' object, start by pressing 'L' for the Line tool and set the Paint color to white (you may want also to turn on the rulers, here, as I'll be referring to specific pixel placement). At the 550 mark on the ruler (i.e. the bottom of the 'sky' object), drag a 3 pixel-width line from left to right (figure 16a). Commit a 4.0 radius Gaussian Blur on it (b); press '0' and stretch its height to approx. 50 pixels (c), press <enter> then split it in half horizontally using the Rectangle mask tool(d & e).

Finally, commit a 6 pixel Scatter effect to it (Creative | Scatter, [identical values @ 6]). Place the 'horizon' object below the tree(s) but above the 'sky' objects in the Docker; stretch its height an additional 20 pixels (approximately) then reduce its Opacity to 15% (f). Save your work.

One final touch to our horizon. If you look carefully I hope you will notice that there needs to be some distinction/transition between the branches and horizon line; some slight blur of some sort. Here's what you can do to remedy this.

In the next step, we'll create a mask from an object. If you like using the keyboard shortcuts - 'Ctrl M' in this instance - be mindful that some can have adverse effects when in use. For example, 'Ctrl M', when coupled with having a mask tool in Normal mode already selected, will result in Subtractive mode ('Ctrl' key) generated mask.

Select the 'tree' object and create a mask from it ('Ctrl M'). Go to Mask | Shape | Expand... and increase by 1 pixel. Go back to the 'Shape' flyout and choose Feather... to set it to 3 pixels, Average. Once completed, select the 'horizon' object then 'Sh Del' to finish it off (double-clicking the Eraser tool is a mouse shortcut for removing the pixel info but it does not remove the mask). This will trim softly the 'horizon' object around the branches of the tree. What do you think? Save your work.

Now that our horizon is done let's add some stars to our sky.

Click on the 'sky' object then the Noise | Add Noise... effects filter (settings : Level @ 75, Density @ 50, Single White Color Mode, Gaussian Type). Next, go to Creative | Particles... and set it to the following specs :

figure 17
Figure 17 :
'Sky' Object Clipped

Now let's fade the 'sky' object so it doesn't end so abruptly. From the Objects Docker, create a Clip Mask (From Object Transparency) for the 'sky' object; keep the Clip Mask selected and press 'G' for the Interactive Fill tool.

Reset the Color Wells to their default (if you added the shortcuts from above, press '7'); drag from the horizon to the top to create a Linear gradient. If it didn't happen by default, set the 'Interactive Fill Style' to 'From Paint to Paper'. Press <enter> to commit, then 'O' to select the Pick tool. Finally, reduce this object's Opacity to 65%. Save your work. Our final feature will be the grass that surrounds the tree.

With the grass, our objectives will be :

figure 18
Figure 18 :
Tree Objects

As you can see from the Objects Docker figure, there is going to be a total of five grass objects; really there are only three but we will get there soon enough. Let's focus on the task at hand.

Create three new objects then rename them and place them according to figure 18. Click on 'grass01' and press 'I' for the Image Sprayer tool. We're actually going to set up and use two brushes, so let's take care of that right now.

The first brush (figure 19, left) to set up will be the Image Sprayer tool whose Brush Type is 'greengrass.cpt' (the intial settings are according to the screenshot).

I've included the 'greengrass.cpt' image sprayer as part of your download in case you don't have it loaded by default.

figure 19
Figure 19 :
Image Sprayer and Brush Settings

The second brush (figure 19, right) is the Object Transparency brush ('2') and will be used to paint on transparency to remove or recede unwanted areas. So, don't worry if most of your stroke is good but some of it got away from you; simply hang on to it, switch to the Object Transparency brush and remove the grass you don't want.

Figure 20 gives the three objects in their partial detail. Let's take one at a time. 'Grass01' is the background grass, if you will, and covers the majority of the area below the horizon.

figure 20
Figure 20 :
'grass01/02/03 evolution

When brushing, consider : don't scrub, stroke. Give the brush time to fill the gaps, but leave areas intentionally dark to give the feeling of shadows. Likewise, do not concern yourself with falling too closely within range of the 'horizon' object; you will be able to remove that with the Object Transparency brush at will.

Concerning options for creating brush strokes : Stroking up/down or back/forth can give away a strokes value badly, quickly giving the appearance of repetition or tiling. Try brushing as though you were creating letters of the alphabet... a 'C' stroke, a 'J' stroke, an 'S' stroke, and a 'Z' stroke; all of which can be drawn upright or as though they were laying on their side (or even upside down). All of these work well to give your grass the appearance of randomness. That is really your goal and why you need to take your time at creating it.

Also, it is the 'Dab Attributes' of the Brush Settings that will increase/decrease the amount of grass painted, so work with those to speed up or slow down the process of adding grass to your objects (the settings in figure 20 are conservative, to say the least).

If ever you want to start your object over again (wipe off your object without removing the object itself), simply press 'delete' while a brush is still active and it will do just that.

When attributing the Object Tranparency tool ('2') to 'grass01/02/03', consider your stroking habits as well. An overly italicized 'J', if you will, or the way a child would create an ocean wave (a bunch of 'u''s strung together) will work nicely to give a random look.

Although I'm giving only snippets as a visual to the narrative (figures 20 & 21), feel free to load the actual image (missing) whenever you like to give yourself better visual clues and comparisons while doing your own work. Otherwise, what follows are merely the details for each of the grass objects.

figure 20
Figure 21 :
Grass around the tree trunk

For 'grass01' : I've already provided a figure (19, above) for the brush settings but, when you are done with the object, reduce its Opacity to 70% in order to darken it a bit. What is more - and it may or may not work visually - apply perspective to this object (Pick tool, perspective transformation, bottom-left handle) to give it a 'spread out' look. About an inch out from the document's edge should do it (but your strokes may serve that purpose well enough so as not to require this; therefore, evaluate accordingly).

For 'grass02' : Increase the Image Sprayer brush size to 27; Spread @ 100; Spacing @ 90. When you're finished, reduce 'grass02''s Opacity to 60%.

For 'grass03' : brush size = 40, spread = 100, spacing = 40. 'Grass03' Opacity will be 50%.

Here's something that is important to consider... 'grass03' is in front of the 'tree' object. Be mindful of spraying when applying grass around the base of the tree (figure 21). And, if ever you feel you have too much grass in your attempts to cover the base adequately, you can always switch to the Object Transparency Brush and pull some of the grass away.

Once you're finished, here, save your work. We have only two more objects then we're done.

figure 22
Figure 22a-b : Creating the 'grass_shadow' object.

The 'grass_dark' comes next (figure 18, above). Make a duplicate of 'grass03' and rename it. Flip the object horizontally (Object | Flip). Set the Merge Mode to 'Multiply' and Opacity to 70%. This will work nicely to add some random shadows.

Create another duplicate of 'grass03' rename it 'grass_shadow' and place it above 'grass_dark'. According to figure, this object will be modified with the Freehand Mask tool. Press 'K' for the tool, set the feather to 20 in the property bar then generate a freeform shape along the lines of figure 22a (note : the screenshot depicts the mask *after* it has been created; i.e. the feather gives it a larger look).

Invert the mask and 'Sh Del' to remove the excess and mask. Change the object's Merge Mode to 'Subtract' and its Opacity to '35%'. With the Pick tool, I 'shift-squished' the shadow object a bit vertically (figure 22b) to reduce the height. Fine tune the results a little by nudging this object so that the shadow effect is a part of the base of the tree in addition to the grassy area overall (compare with figure 21, above). Once finished, save your work.

image complete

At this point you might want to 'F9' to look at the work and see where you may want to redefine or touch up a bit key areas. Otherwise - I am sure - you're work is looking pretty good. Notice how the grass gives us a wonderful sense of placement for the tree and how the 'horizon' object now marks the end of the field of grass with its spattered edge. Likewise, the greens and their shadowy mystery really help define the tree's branches where they transition from tree to grass.

If you're like me you might want to distance yourself from your work for a bit. Hopefully, upon return, you can take a fresh look at all your work to admire the result anew. This marks the conclusion to this exercise.