©2002 By Jeff Cantin aka TinCan on IRC
This tutorial is divided into 3 parts; the first part describes what an alpha channel is and how to create one in Photoshop, part two is about how to blend images by using an alpha channel, and part three is about how to create images in AM with an alpha channel and why you would want to do that.
OK, first of all this tutorial is intended to help you understand the basics of working with an alpha channel in your image editor, I will be using Photoshop. This tutorial is not intended to cover every case you can think of, but, I feel if you understand the basics then you will be able to work out any solutions you may need. I AM NOT a Photoshop expert, what I'll show you has worked very well for me in making decals for use in Animation Master. I will use the term PS for Photoshop and AM for Animation Master as shortcuts throughout the tutorial. Let's start off with a good definition.
A good definition came from Joe Maller's site (used with permission) in it he states:
RGB and Alpha channels
"Images are constructed from a mix of red, green and blue light channels plus one alpha channel to define transparency. Channels are easiest to think of as grayscale files, each pixel's brightness value translates to the intensity of the corresponding color. For Alpha Channels, each pixel's brightness indicates the opacity of the corresponding pixels. Each channel is made up of 256 levels of gray (8 bits), when all four channels are combined they can create over 4 billion combinations of color and transparency (32 bit color). The range of numbers between 0-255 appear frequently referring to pixel values in channels and averaged pixel values of whole images. Remember that computers usually start counting from zero instead of one."
I feel it is important to do this tutorial rather than just reading it, so... Launch both AM and your image editor and let's get started. In Windows you can Alt+Tab to quickly switch between the two applications.
In AM make a four patch model to keep things simple. I made mine a 40cm square.
As you can see I flipped two normals to demonstrate that normals direction will not matter with color or bump type decals in AM. If you want, go ahead and flip a few so that we are staying exactly the same. Save your Project now. Switch over to PS and create a new image (because our model in AM is square, make your new image size a square as well) for this tutorial, size won't matter so 500 x 500 pixels should be fine.
If you don't have the channel tool open, then select "show channels" from the Window drop down menu and click on "create new channel."
Kewl, we just created an Alpha Channel and its all black (meaning everything is transparent). Save this image now as a TGA. Let's name it !test-alpha.tga so we can refer to this name during the rest of this tutorial. PS will display an options box with 32 bits/pixel selected, click on OK. Now lets apply this as a decal in AM, we are going to do this interactively and step by step so you can see the effects in AM. Please be patient and stay with me. When positioning the decal in AM, size it to cover the entire four patches, then whack* apply! Click on the model's shortcut and change its base color to Dark Blue, for example. Save the project. Do a test render, the decal does not do anything! :-) Why? Because the entire decal is transparent! DOH!
*Whack: to quickly apply pressure to a key or mouse button in order to execute a command. :-)
Now the fun begins! Switch back to PS and set white as your foreground color and select the airbrush tool. Draw a doodle directly on the black alpha channel. I drew this. Save the file using the same name (!test-alpha.tga).
Switch back to AM and do a test render now, your doodle should show up. But we aren't finished yet! Back to PS! Click on the layers tab (channel toolbox) and then click on the background layer to be sure thats the active workspace. Next select the gradient tool (sometimes it's hidden behind the paintbucket tool) and select a wild preset gradient, apply this to the background layer. Mine looked like this:
Save the image again, and do a test render in AM... Below is the rendered AM image (and remember the dark blue came from the patch color of the model and not from the decal).
My rendered AM
background of the PS decal The
alpha channel of the PS decal
OK! Lets examine what we have here... The color of the image came from the background layer of the PS decal and what part of the decal that gets displayed is determined by the alpha channel. In the alpha channel anything that is near white or pure white will allow the colors from the background layer of the image to show up in the decal (as shown on "My rendered AM Image"). What is pure black in the alpha channel is completely transparent so we see the AM patch colors in the render. All greys in the alpha channel will allow a proportionate amount of color to show through, shades closer to white allow more while darker greys allow less, thus we can feather an edge.
Note: I chose the airbrush tool in this tutorial to demonstrate that even blured edges do not get a "halo" effect when the image is applied as a decal in AM. Furthermore, if you want to change the colors of the decal, just change the color of the image's background layer. Try setting red as the foreground color and yellow as the background color, then select filter, render, clouds and see what happens! Also try changing the type of decal to cookie cut, and do a test render. The more tests you do the more you'll understand the principle. Have some fun and try a bunch of tweaks 'n test renders... When you feel you "got it," then go on to part two.
OK, Lets put what we learned to a real example. Let's take a few images and apply them to our 4-patch model, first apply the grunge map (click on the first three images and save them to your hard drive if you don't have your own images).
Open the roof tile image in PS and make an alpha channel. Use the gradient tool "Black to White" and change the alpha channel to look like the blend below, or, copy the blend image directly to the alpha channel. Save it as a 32 bit TGA like we did earlier. In AM, add the new 32 bit roof image to the same decal folder as shown below. To add more images to the same decal folder in AM, right click on the image part of the decal folder and select "add image."
Save the project and do a test render, we should get a blended image like the example below! Again, fool around with the gradient in the alpha channel, be daring... It's very important to experiment, it will help you in the long run and reinforce what you already learned.
Alrighty then! We blended one decal over the other and generated a kewl transition. Think of the possibilities! Imagine this, or even better try this, instead of the grunge map... use a procedural AM material like wood, now the roof decal will blend with any surface you can think of! Or in general terms--your decals can transition/blend anyway you desire... now that you control the alpha channel!
Now we are going to go in the reverse direction, that is, create an image in AM with an alpha channel and alter it in PS! This is intended to show how special effects and other techniques can take advantage of an alpha channel. I loaded the B-25 model from the CD, dropped it in the choregraphy and positioned it and the camera to make a nicely framed image. The screen capture below shows what it looks like with the camera looking up at the B-25 in shaded mode. You can see the ground plane on the bottom of the image and also see the camera's background color is sky blue (default in V9.5).
In the next image I show the render to file selector box and I have marked two arrows in red. One points to where the Alpha option is and the other arrow shows that anything other than model(s) turns black when rendered with an alpha (which is what we want and is normal). I'm telling you this because it surprised me the first time I used alpha in AM and I had a camera rotoscope that turned black! You should notice the ground plane and the B-25 are rendered as you would expect.
It's time to switch to Photoshop and look at our rendered image. When we open the image in PS and look at the channels tool (red arrow) you can see AM generated a mask (black) everywhere and cutout our model(s), in this case the ground and the plane. Now press the control key and click on the Alpha 1 channel, instantly the model portion of the image is selected!
Select copy, and while the selection is still highlighted, whack paste, you should see just the plane and ground will be pasted onto a new layer called layer 1 (see red arrow below). Next, select the Background layer, and from the Layers menu select new layer, layer 2 should apear between the background and layer 1. Paste any image into layer 2 (I pasted a sky image) and instantly the plane looks like it's in a cloudy sky perfectly blended thanks to AM's ability to create a perfectly matched alpha channel.
Now, it's your turn to use your models and images, you have the knowledge, and now you have the power... GO CREATE!
That's all for right now, sometime in the future I will add more, but this should get ya started! Please lemme know if you found this helpful...
If you learned something from this tutorial, please drop me an E-mail at Jeff Cantin
This is an important step, I track the number of visits to "thank you" notes, I need to know my time and my web space is well spent.
I have other tutorials linked from my hobby homepage. Give those a try too when you are ready.