Wiki Page Comments  

Avoiding black edges around your alpha.

This tutorial will show you how to avoid black lines around the edges of your textures that have alpha information.

Yes this tutorial looks long and complicated, but just stick with it and read it all the way through. When you have done this procedure a few times, you can fly through it really fast.

For This tutorial I am going to use a fern.tga texture that already has an alpha map created in it.

So I am going to start with this image:

And this is what the alpha for it looks like:

What we are basically going to be doing is blurring the image past the alphas edge, so that any color information the alpha map grabs, it wont be black.

It is also good practice not to create your image on a black background, (like this image is) but instead, choose a color that is most dominant in your image, (in this case, green) and go with that.

Ok so here is the base color layer in photoshop:

Now if you click on your "Channels" tab (highlighted in red below) you switch to channel view, and you can see your Red Channel, Green Channel, and Blue Channel, as well as your Alpha Channel:

What we want to do is copy the alpha channel (you'll see why in a minute). So click on the Alpha Channel, and click on the eyeball next to it so it becomes visible:

Now press Ctrl+A to select the entire image, then press Ctrl+C to copy it:

Now we have the alpha channel stored. We will use it in a minute. Go ahead and click on the RGB channel at the top. It should unselect the Alpha channel, uncheck the eye icon next to it, and select the RGB, Red, Green, and Blue channels automatically. If it doesnt, then go ahead and do this now.

Now lets go ahead and duplicate the Default Background Layer. Click on the "Layers" tab at the top of the layers window and Right-Click on the Background Layer. A menu will pop up and select "Duplicate Layer":

We just duplicated the layer. Now what we want to do is use the Alpha map to cut away the black areas of the layer so we can blur it. With the new (top) layer selected, click the "Add Layer Mask" button at the bottom of the layer window:

A new icon appears next to the original one showing that a Layer Mask has been added. Click the empty layer mask icon, then click on the Channels Tab again:

Select the new layer mask, and Click the eyeball next to the new layer to make it visible. Then click the eyeball next to the RGB channel to hide the RGB, Red, Green, and Blue channels so that the only channel visible is the new Layer Mask channel:

With only the Layer Mask channel selected and visible, press Ctrl+V to paste the alpha channel into the layer mask. Now click the RGB Channel again and hide the layer mask channel by clicking on the eyeball, so that only the RGB, Red, Green and Blue channels are selected and visible. Then click on the "Layers" tab again. Your Layers window should look like the following:

Now lets apply the layer mask. Make sure the layer with the layer mask is selected, then at the top of the Photoshop window, select Layer > Layer Mask > Apply.

Phew! Complicated huh? Not really. Basically what we have done up to this point is duplicate the color layer, and apply the alpha channel to it. It seems long and complicated, but its really not. Once you do it a couple times you can fly through this stage.

Ok, almost done. Now right-click on the top layer and choose "Duplicate Layer". What we want to do is keep the top most layer and make duplicates underneath it and blur those.

Select the layer underneath the top layer and choose Filter > Blur > Gaussian Blur. Set a pretty high radius, in this case I used 20.

This is what my image looks like so far:

Its headed in the right direction, but the blur area isnt opaque enough yet. Right click the blur layer and duplicate it a bunch of times so that the area around the alpha is opaque:

This is the final image I came up with:

Notice how the surrounding area around the leaves is green. Now when the alpha cuts out around the leaves color, the black background wont bleed into it and it will remain green.

This works good for any textures you have that have an Alpha with them. It will bleed the color of the texture out past the alpha map and prevents it from reading the background color into your texture.

Hope you guys enjoyed this tutorial, and questions or comments please e-mail me at atrusdni@aol.com.

Last edited by Bob S on Friday, July 3, 2009