MORPH MAKING TUTORIAL Featuring Dave Mason's DMORF and DTA Shareware Programs For more information, visit the GRAPHDEV forum on CompuServ Morph, as in MetaMORPHosis, is the process by which one image smoothly melds into another image. The process is used in movies, television and commercials but until recently could only be done by people with special hardware and software. Today, given the power of PCs and the imagination and creativity of artists, mathematicians, and programmers, you'll be able to Morph between any two images you happen to have. Although the effect is normally done with faces, you can use anything you like. Car commercials often Morph from one model year to the next. This tutorial explains the steps required to MORPH two images using two excellent shareware programs by Dave Mason. The first one, DMORF (Dave's Morph), is used to specify how the morph should look. It will generate as many frames (image files) as you ask it to, with each one showing a greater change from the first image to the second one. For example, if we're morphing a picture of you at age ten to you at age twenty and specify a 10 frame morph, then the first frame should resemble you at age 11, the next at age 12, until you reach 20. (This really works...). Anyway, when DMORF is done, you'll have 10 Targa files named MORF0001.TGA through MORF0010.TGA (although you can change these names). The next thing you'll do is run DTA (Dave's Targa Animator) which will combine the .TGA files into a single .FLI file which will default to the name ANIM.FLI. Finally, you'll run PLAY ANIM.FLI and watch yourself grow old. It's that simple! Before going any further, read the file named DMORF.DOC. It explains how to install DMORF and the basics of how to use it. It also explains that these programs are SHAREWARE and that it's socially acceptable to pay for them if you like them. Let your conscience be your guide. Once you know it's installed correctly, come back here and we'll start morphing. We're going to try two different morphs using the sample files that came with the tutorial. In the first lesson, we'll morph The Terminator into Lieutenant Warf. (An ENFORCER Morph). In this morph the faces line up fairly well, which greatly simplifies things. In our second lesson, we'll have to work harder to get the right effect. Keep in mind that MORPHING IS ART - NOT SCIENCE! No two morphs look alike whether they're done by the same artist or different artists. Also, what might appear like a mistake when you're doing it can often turn into a great new effect you hadn't though of before. Just relax, have fun, and use your RIGHT BRAIN. LESSON 1: Arnold -> Warf You'll find several Targa (.TGA) files on the disk. We'll be using ARNOLD.TGA (Terminator) and WARF.TGA (Lieutenant Warf). In case you're curious, ARNOLD was captured from video tape using a VideoSpigot from Creative Labs. WARF started out as a GIF file. Both images were scaled to 240x180 and their backgrounds were removed using Corel PhotoPaint. THINGS TO KNOW: 1. ALWAYS make the images the same size!!! 2. Removing the background results in MUCH better morphs. If you don't, the backgrounds morph too. OK. Start Dave's Morphing Program with the BEFORE and AFTER images by typing: DMORF ARNOLD.TGA WARF.TGA This will load ARNOLD as the BEFORE Image and WARF as the AFTER Image. Don't worry if they come up in Black & White, they're full 24 bit color images and the output images will be too. The buttons on the bottom of the screen are explained in the DMORF.DOC file so we'll just concentrate on building a mesh. What's a Mesh? Before I answer that, let's look at how Morphing works. Deep inside DMORF is a Pixel Interpolator. It knows how to interpolate pixels from Point A to Point B as well as how to interpolate the color of the resulting pixel as it approaches Point B. The only thing it doesn't know is which points you would like interpolated where. If you told it absolutely nothing, it would move the point 1,1 in Image A to the point 1,1 in Image B and so on. This would result in a much simpler effect known as a dissolve, where the colors from Image A slowly give way to the colors in Image B. Obviously that's no fun. We want Image A to slowly distort both its shape AND its color until it actually BECOMES Image B. We'll do this by specifying the KEY Points on Image A which are to migrate to Image B. If we specify enough of them, DMORF will be able to interpolate between them and give us a professional quality morph. Now, what's a Mesh? A mesh is a series of vertical lines which intersect a series of horizontal lines. The points at which they intersect are the mesh points. We'll be drawing a mesh on ARNOLD and on WARF such that each intersection (mesh point) represents a pixel that we would like to migrate. Before we go any further - when I talk about ARNOLD's LEFT EYE, I mean the one on YOUR LEFT not ARNOLD's left (It's really ARNOLD's right eye, but he's not here to argue right now). Note that there is a frame around each of the images. Let's begin by positioning the mouse on the frame directly below ARNOLD and under his LEFT eye. Click the RIGHT mouse button. You should see a red vertical line running through (or nearly through, depending on your aim) his left eye. If not, you're not on the frame. Find the frame around the image and try again. Remember to use the RIGHT button. Now position the mouse on the frame to the left or right of ARNOLD but lined up with the center of his left eye again. Click the RIGHT button and you should now have a horizontal line crossing a vertical line in ARNOLD's left eye. That's a mesh point. If you look over at WARF you'll see his mesh point. This is the same physical coordinate as the one on ARNOLD and is where ARNOLD's eye would end up if we weren't here to intervene. Since we don't want his eye on WARF's forehead, place the mouse over the mesh point on WARF, press the LEFT button and drag it to the center of WARF's left eye. By the way, if you missed ARNOLD's eye before, you can move the mesh point on his picture too. It doesn't matter which side you add the points and where you move them. When you're done, DMORF simply takes each intersection, reading from left to right, top to bottom, and matches it with the intersection on the other image. It then interpolates pixels and colors so that they migrate toward these points. Everything else just flows along. What you CAN'T DO, is let these lines cross each other. DMORF will try to prevent this, but if you trick it, don't be too proud of yourself - it will blow up later. All this means is that you need to think out your work a little before you start. The other thing you should do is save the mesh points frequently. Press the SAVE button and type something like STEP1.MSH and so on until you finish. You now know everything there is to know (about morphing). You probably don't believe that so I'll go right on talking. The point is, once you specify the key points, DMORF is ready to interpolate. As I said before, the more you specify, the better the morph. Now let's do the RIGHT eye. Place a vertical line on either picture that you like and then drag the mesh points to the center of each guy's RIGHT eye. The next thing I'd do is add a point at the corner of one of the mouths and then move the corresponding point on the other face. You might want to add some points outlining ARNOLD's glasses and make these match WARF's eyes. By now you've probably noticed that the lines are no longer perpendicular. As I said earlier, Morphing is Interpolating. The lines constantly interpolate to follow the flow of the mesh points. If you haven't already done so, try pressing and holding the SPLINE button. If you have the SPLINE MESH box checked when you generate the morph, the splines will actually look like this to the pixel interpolator. Sometimes these splines will appear to "go nuts". As you add more lines, this often tends to correct itself. Save your work now by pressing the SAVE button and coming up with a creative name other than LESS1_1 (or anything like that). Make sure you give it a .MSH extension. Now press the LOAD button and retrieve LESS1_1. That's what I created. It's probably different but similar to yours. What's wild is that those (minor?) differences will result in a completely different morph. You can load my LESS1_2 through LESS1_4 files to get an idea of the steps I took with this morph. I tend to work my way out from the eyes, nose and mouth to the ears, hairline, chin, cheeks and then down to the neck and shoulders. Feel free to experiment. In LESS1_2 I've begun to outline the hairline and right side of the head. By LESS1_3, I've finished the facial features. LESS1_4 seems like a big step but all I've really done is click the mouse along the frame in the areas in between where I was working to fill in the gaps. DMORF did all the line bending. You can almost see how the faces will warp now (if you know what to look for - you will after a while). Let's leave my LESS1_4 loaded and generate the morph. Then you can go back to your version later and try it yourself. In the middle of the screen on the bottom are some controls relating to the number of frames to generate. I usually generate 20 frames when I'm experimenting. The more you generate, the smoother the morph. Television is 30 frames per second. If you're going to put the results on videotape, you can figure out how many frames based on how long the sequence should last. Anyway, scroll the FRAMES value to 20. You'll notice that the LAST FRAME value follows along. You can set the START and LAST frames independently, which allows you to generate individual frames in the middle of the morph if you like. If you look in the lower right corner, you'll see the word MORF. You can change this to any 4 characters you like. The way DMORF uses this is to generate output files using those 4 characters plus a 4 digit frame number, ie. MORF0001.TGA, MORF0002.TGA, etc. Leave it alone for now and lets generate a morph. PRESS GO. If you weren't sure if your machine had a math coprocessor, here's how to find out: If you see percentage figures flying by, you've got one, otherwise, you might as well go take in a good movie (or get a good night's sleep) 'cause this is gonna take a while. Otherwise, in 5 or 10 minutes we'll be ready to take the next step. PRESS QUIT. You're back to DOS. Now if you do a DIR MORF*.TGA you'll see the results. Now we need to assemble these into a .FLI file so we can see the animation. (Actually, you may have Presentation software that will assemble these in some playable format too). To make a .FLI we'll use Dave's TARGA Animator - DTA. The frames we generated did not include the starting and ending frames since we already had these. Run DTA by typing DTA ARNOLD.TGA MORF*.TGA WARF.TGA /P /S3 This will assemble the files (in this order) into a .FLI file called ANIM.FLI. You can override this if you checkout the DTA.DOC file. I leave it this way so that I can keep replacing ANIM.FLI with other tries until I like the result. Then I rename it to something more distinctive. The /P parameter causes a Ping-Pong effect which you'll like. The /S3 parameter sets the playback speed to 3. You can experiment with this if you like. Now run PLAY ANIM.FLI How's that? If it's too fast (or slow), the number keys across the top of the keyboard can be used to change the speed. Press ESC when you're done. CONGRATULATIONS! George Lucas has an opening but you'll probably have to relocate. OK. Let's do an "alien morph". We'll start with Mr. Spock and end with ET! When we're done, you'll realize that all aliens look alike. Start DMORF by typing: DMORF SPOCK.TGA ET.TGA As you examine the meshes for this one, you'll see that quite a bit more stretching of the mesh points is necessary to get the right effect. Proceed as you did in the first lesson. You'll probably want to load LESS2_1 through LESS2_4 to study the way I did it and then try it yourself. When you're done, you'll have my favorite morph. Feel free to use CompuServ - GO GRAPHDEV - if you need help. The authors as well as many users spend their evenings there. Hope to see you there.... Ken