DMORF Rel 1.1.2 (08/09/93) Documentation Copyright (c) 1992, 1993, by David K. Mason. All Right Reserved. DMorf (Dave's Morphing program) is a small morphing program that runs in DOS graphics mode. It operates on TGA, GIF, and IMG files, and produces a bunch of TGA files as output. You can compile these TGA files using my other program, DTA, or dump 'em straight out to video if you've got the hardware. (note: also take a look at WHATSNEW.DMO... that file is sometimes more up-to-date than this one is) --------------------------------------------------------------------- Hardware requirements: To run DMorf, you MUST have: 1) A VGA monitor 2) At least a '286 3) A mouse with a microsoft-compatible driver 4) *some* extended memory (expanded memory is not useful). To accomplish any serious work with this program, you SHOULD have: 1) SVGA board with VESA in BIOS or with a VESA driver. By default, DMorf will use the 640x480x256 mode. If you use the /800 command-line switch it'll use 800x600 mode instead. The /1024 command-line switch tells DMorf to use 1024x768 mode instead. 2) A fast processor *and* numeric coprocessor... DMorf DRAGS without a copro. Right now the 486DX is the best chip to have because the coprocessor is integrated on the same chip. (When the Pentium comes out, it should be fantastic because of its optimized floating point instructions.) 3) *Lots* of extended memory, unless you're working with teeny pictures. This program runs in '286 protected mode, and allows access to up to 16M of extended memory. ( During the warping process, DMorf creates a buffer big enough to hold one entire picture, in RGBa (32-bit) form. That means 256000 bytes if you're working with 320x200 pictures, or 1,228,800 for 640x480, or 1,920,000 for 800x600, or 3,145,728 for 1024x768. ) You can speed DMorf up quite a bit using the /PRELOAD command-line switch... it loads copies of both pictures into memory at startup thus when displaying, editing, or morphing, it won't have to read the pitures from disk. Also, it causes some intermediate pictures to be stored in memory instead of saved and loaded from disk. This can save significant time, but uses a *lot* of memory.... multiply the numbers in the previous paragraph by 3 or 4. --------------------------------------------------------------------- DOS-Extender Files The DOS-Extender Files from the Borland Pascal compiler (DPMI16BI.OVL, RTM.EXE, and DPMIINST.EXE) must exist somewhere in your DOS path, or in the same directory where you keep DMORF.EXE.... or DMORF will not work at all. These files are in the DMorf archive. If you've got an unsupported 286 processor (you'll know, because DMORF will complain loudly), then you'll have to: (1) disable any memory management software you have running (like HIMEM.SYS) and reboot your system. (2) run the other program in this archive, DPMIINST, which will configure RTM.EXE for your system and then (3) turn any disabled memory managment stuff back on and reboot your system again. --------------------------------------------------------------------- Multiple versions: DMorf 1.1 comes in two varieties: DMORF.EXE and DMORFNC.EXE. Both versions can run in systems that either have or don't have math coprocessors, but DMORF.EXE will run much faster on systems with coprocessors, and DMORFNC will run faster on systems that DON'T have coprocessors. If you have a choice, use DMORF.EXE and a coprocessor. Sorry, but because it uses a different method of representing floating point numbers, DMORFNC.EXE will not be able to read mesh files created with versions 1.0 and earlier of DMorf. You could get around this by loading a mesh file into DMORF.EXE, saving it in the 1.1 mesh file format, and then loading the new mesh into DMORFNC.EXE. --------------------------------------------------------------------- Credits The warping, morphing, image scaling, and spline algorithms all come (with modification) from George Wolberg's excellent book Digital Image Warping. The user interface stuff is all mine. Thanks to Michael Day (Knight Software) for making his VESA BGI graphics driver (BGI256) available. Thanks to Lutz Kretzschmar for letting me use his SVGA mouse-handling code, and for all his great ideas for enhancements. Thanks to Eric Deren for his neat ideas on manipulating meshes, and for his contributions to this documentation. Thanks to all of the Compuserve GRAPHDEV forum gang, and the Graphics Alternative BBS gang for their suggestions, and various bugs they've helped me identify. --------------------------------------------------------------------- Disclaimer If you use DMorf, you do so at your own risk. I won't be held responsible if it screws anything up. --------------------------------------------------------------------- Support If you've got any requests/bug reports/suggestions, send a message to: "David Mason" on the "You Can Call Me Ray" BBS, (708) 358-5611, and on "The Graphics Alternative", (510) 524-2780, and on "Channel 1" BBS, (617) 354-8873. "76546,1321" on Compuserve. From the Internet, it's "76546,1321@compuserve.com" You'll probably get some kind of a response (maybe sooner, maybe later). You could also send paper mail to the address listed a bit later in this document, but I'm *terrible* at answering my mail. I much prefer electronic mail. --------------------------------------------------------------------- The Rules Feel free to re-upload this program to other bulletin board systems in its *original, unmodified* form. Don't change the name of the ZIP file... it's supposed to be called DMORF111.ZIP (except on Compuserve, where it's called DMORF.ZIP). You may not repackage it with other software. You may not repackage it with your own tutorial. I feel like an idiot having to make these demands, but people have been doing these things. Do not include this on a disk along with any magazine, book, hardware product, or other software product without my permission. --------------------------------------------------------------------- Money matters DMorf is a shareware program. If you think this program is worth it, send some money or some computer hardware or something to: David K. Mason P.O. Box 181015 Boston, MA 02118 I think $35 is an appropriate amount, but feel free to send more or less. --------------------------------------------------------------------- How to use DMorf: To get started with DMorf, type "DMORF " The files can be TGA (16, 24, or 32, compressed or uncompressed), Vivid IMG, or GIF. The two files don't have to be in the same format, but they do have to share the same dimensions. DMorf will then read and display the two pictures in side-by-side windows. If you only supplied one filename, then it'll display that picture twice. It scales them so they'll fit in the windows. Then, it lays a mesh over the two pictures. In this program, a mesh is represented by a bunch of horizontal and vertical lines. The points where they intersect can be adjusted. Initially, there are lines on the four edges of the picture. There are always the same number of mesh points defined in the two pictures, though they aren't always in the same places. To add a new line to the mesh, move the mouse cursor to the border around one of the pictures (which one doesn't particularly matter). Click the *right* mouse button at the point where you want the line added. (If the cursor is on the top or bottom border, a vertical line will be added, and if it's on one of the sides, a horizontal line will be added.) To move a vertex, put the mouse cursor over the intersection of two lines, press the button, and move the mouse. Let go of the button when you've got the point where you want it. DMorf will try to prevent you from overlapping lines. It's possible to defeat it with weird angles. Don't do that... it's bad. The point of these meshes is to define the shapes of the objects in the pictures. The lines should match the contours of any objects in the scenes. Move the vertices of the lines so that the lines match the curves of the objects in the pictures. When you've got meshes that you're satisfied with, click on the "Go" button and watch. After you've saved a your mesh in a .MSH file (using the Save or SaveAs button), you could start DMorf by just typing "DMORF MESHFILE.MSH". DMorf will remember the names of your picture files and any settings particular to your morph sequence. --------------------------------------------------------------------- Command Line Options: Usage: Dmorf [file 1] [file 2] [meshfile.msh] [options] Options: /800 sets display to 800x600 /1024 sets display to 1024x768 /Go tells DMorf to begin morphing immeadiately. (Note: Requires a meshfile.) /Preload loads images into memory for quicker access Except for the fact that [file 1] must come somewhere before [file 2], the order of parameters doesn't matter. "dmorf x.tga y.tga xy.msh /800" is identical to "dmorf /800 x.tga xy.msh y.tga", as far as DMorf is concerned. If you specify a meshfile on the commandline, then you don't *have* to type the names of your picture files too because the picture file names are stored in the meshfile along with all of the other settings. You only have to type the picture file names in addition to the meshfile name if you want to load pictures that are different from the ones that the meshfile points to. --------------------------------------------------------------------- DMorf Command Listing Main Menu File Dialog This dialog box consists of all the picture and file manipulation options and features. Go Causes DMorf to start morphing or warping. Quit Changed my mind. Get me out of this program NOW. The escape key does the same thing. Save Saves your meshes and settings to the current control file. It doesn't prompt for a filename unless the mesh is unsaved. Save As Saves your meshes and settings to a user specified control file. Always prompts for a filename. If no extension is specified ".MSH" is assumed. Load Loads a control file. Updates morph images, meshes and all DMorf parameters to the ones saved in the control file. Always prompts for a filename. If no extension is specified ".MSH" is assumed. Reload Re-loads the current control file. It doesn't prompt for a filename unless the mesh is unsaved. About Displays DMorf copyright information. Settings This displays the Settings dialog. Settings/Morph Switches dialog This dialog box consists of the options that control the Image Warper and the way it handles the image warping for both morphs and warps. Settings/Spline Mesh Tells the Image Warper to use spline curves instead of lines when generating the morph or warp files. Reasons to use splines instead of lines: (1) The bent image has smooth curves and gradients. (2) The morph or warp often looks a whole lot more fluid and lifelike. Reasons to use lines instead of splines: (1) Splines sometimes go haywire, with curves going every which way, overlapping, and (gasp) sometimes even passing beyond of the picture borders. (2) You don't want something curved when it warps (3) lines are faster than splines. Settings/Spline Intervals When activated, the Image Warper remaps intervals between mesh lines using splines instead of linear interpolation. The result is a more natural looking warp, and pros and cons are similar to the ones for the Spline Mesh setting. Settings/Spline Always Uses splines for all mesh editing operations, as opposed to the default lines. Ideally this would be automatic whenever "Spline Mesh" is selected, but it works way too slowly except on the fastest of machines. Settings/Smooth Resampling With Smooth Resampling activated, DMorf interpolates new pixel values from all source pixels that should contribute... if you turn this control off, it just grabs a the closest pixel value. Nearest neighbor or dumb mode, in other words. The results in smooth resampling mode look massively better than dumb mode. The tradeoff is that dumb mode is massively faster. Dumb mode is useful in test runs, but don't use it for real stuff, 'cause it looks like crap. Settings/Just Warp In the default morph mode, the DMorf will map points from the shape of the mesh picture #1 toward the shape of the mesh on picture #2, and then from 2 toward 1, and cross- fade. With the Just Warp option activated, it'll just map points from mesh #1 toward mesh #2, with no fade. Not too surprisingly, Just Warp mode takes half the time that Morph mode does. Settings/Show In-Betweens DMorf usually displays, while morphing, all the intermediate pictures it creates. If you turn off this switch, it won't, and it'll finish quicker. Settings/Verbose Status DMorf usually displays the frame number it's working on, plus the percentage of the warp that it's finished. With verbose status switched off, it lists only the frame number. Settings/Frame Info dialog This dialog box consists of options that control the choreography for the Image Warper. Settings/Frames This tells DMorf how many pictures to create. If you're in Morph mode, then this represents how many tween frames to create. In Just Warp mode, this number includes a fully-warped final frame. Settings/First Frame First Frame specifies the first frame to render in the range 0 to Last. Useful if you only need part of a morph. Settings/Last Frame Specifies the final frame to render in the range First to Frames. Settings/Warp 1/2 This setting determines the speed of the warping mesh. Specifically, the number determines at which percent of the morph the mesh should be warped halfway between the before and after meshes. Settings/Fade 1/2 This setting determines the speed of the crossfade during a morph. Specifically, the number determines at which percent of the morph the fade should be halfway between the before and after images. This setting has no effect if the Just Warp option is active. Colors This displays the Colors dialog. Colors/Mesh The three sliders in the Mesh dialog box control the red, green, and blue component colors of the warp meshes. Colors/Alpha The three sliders in the Alpha dialog box control the red, green, and blue component colors of the color used to represent pixels that are more than 50% transparent. Colors/Gamma Settings Color values in computer graphic images are based on linear intensity values. In programs that deal with 24 bit color, each pixel color is stored as one byte for each component color of red, green, and blue. A pixel value of (127,127,127) has half the intensity of a pixel value of (254,254,254). However, video equipment and the human eye responds non linearly to intensity. So the color (254,254,254) will not appear twice as intense as the color (127,127,127). To fix this phenomena, especially when outputting to video, the image can be Gamma Corrected. The gamma correction is calculated for every pixel using the gamma value, which represents the non linearity of the monitor. Typical values of gamma are usually around 2.0. Using an excessively large gamma will make your image very bright and will reduce the contrast. A small gamma will usually result in a dark image. NTSC standard gamma correction is 2.2. Gamma should not be applied to a computer image more than once. Colors/Gamma Settings/File This value specifies the gamma correction value that's already been applied to the picture. Colors/Gamma Settings/Disp This value specifies the new gamma correction value for the screen. Pictures This displays the pictures dialog. Pictures/Input Files dialog This dialog box allows user specification of the input files. Pictures/Before Specifies the name of the picture to morph from. Pictures/After Specifies the name of the picture to morph to. Pictures/Background Specifies the name of the picture to overlay the morphed frames onto assuming the morph pictures have transparency. (NOTE: this option currently has no effect. In the future, when DMorf shells out to DTA, it'll use this value to build the DTA command-line.) Pictures/TGA Switches dialog This dialog box allows the user to specify what flavor of TGA files DMorf creates. Pictures/Bottom Up Tells DMorf whether to create TGA files that begin at the bottom of the screen, or at the top of the screen. Some programs can only read one or the other variety. (DTA can read both, but prefers bottom-to top) Not to be confused with "bottoms up!" Pictures/32-bit Tells DMorf whether to create 24-bit or 32-bit TGA files. The only reason you might want to use 32-bit TGA files is if you're planning to do compositing. Some programs can only read 24-bit TGA files. (DTA can read either) Pictures/RLE Tells DMorf whether or not to create run-length encoded (compressed) TGA files. Compressed TGA files are almost always smaller than non-compressed, but some programs can't read them. (DTA can) Pictures/Output Files dialog This dialog box allows the user to specify options for the output files. Pictures/Prefix Prefix specifies the prefix for the saved TGA files. Default for morphs is MORF and for warps is WARP. Max (maximize) Displays just the selected image much larger on the screen and switches to the Maximize dialog. This gives finer control over the mesh control points. Max/Other This option toggles the display between the Before and after pictures. Max/Zoom In This allows you to further zoom the display for detailed adjustment of the mesh control points. To use, select Zoom In, then move the mouse cursor to a corner of the section you want to magnify. Click and drag the mouse to place the opposite corner. The display will then show the selected area in the aspect you selected; no aspect ratio correction is done. Max/Zoom In/Colors This displays the colors dialog. See description under the Main Menu. Max/Zoom In/Zoom Out This unzooms the view and returns you to the Maximize dialog. Max/Zoom In/Settings This displays the settings dialog. See description under the Main Menu. Max/Zoom In/Spline This gives you a preview of what splines for the current mesh points would look like. It converts the lines on the screen to splines temporarily. Press and hold. Max/Main This returns you to the Main Menu. Max/Colors This displays the colors dialog. See description under the Main Menu. Max/Settings This displays the settings dialog. See description under the Main Menu. Max/Spline This gives you a preview of what splines for the current mesh points would look like. It converts the lines on the screen to splines temporarily. Press and hold. Edit Displays just the selected image much larger on the screen and switches to the Edit dialog. This gives finer control over the mesh control points. Edit/Other This option toggles the display between the Before and after pictures. Edit/Main This returns you to the Main Menu. Edit/Colors This displays the colors dialog. See description under the Main Menu. Edit/Flip H This flips the current image horizontally. (vertical mirror) Edit/Save This saves the current image into a 32-bit TGA file (so the alpha information is saved) using the original filename with a .TGA extension. It changes the filename in the Pictures dialog to this new name, as well. Edit/Save As This has the same features as Edit/Save, but saves to a user-specified filename. The .TGA extension is assumed. Edit/Alpha Blur Alpha Blur performs a weighted blur filter against just the alpha channel. This helps a bit since DMorf's rudimentary alpha editing doesn't support fractional values. Edit/Zoom In This allows you to further zoom the display for detailed adjustment of the mesh control points. To use, select Zoom In, then move the mouse cursor to a corner of the section you want to magnify. Click and drag the mouse using the left mouse button to place the opposite corner. The display will then show the selected area in the aspect you selected; no aspect ratio correction is done. Edit/Zoom In/Colors This displays the colors dialog. See description under the Main Menu. Edit/Zoom In/Zoom out This unzooms the view and returns you to the Edit dialog. Edit/Key This allows the user to key out certain colors and give them complete alpha transparency. To use, select the Key button, then place the mouse cursor over the color in the picture that you wish to be given full transparency. Press the left mouse button, and that color will assume the color set for alpha in the Colors dialog. Edit/Tolerance This tells DMorf how close a pixel's color has to be to the Key color. Mesh dialog This dialog box consists of all the mesh manipulation options and features. Hide Temporarily removes the mesh display from the images. Useful for image inspection. Spline Spline gives you a preview of what splines for the current mesh points would look like. It converts the lines on the screen to splines temporarily. Press and hold. Swap Swaps the meshes between the two windows. FlipHz Flips one of the meshes horizontally. 1->2 Copies the mesh from window 1 (before) to window 2 (after). Replaces whatever mesh was in window 2. 2->1 Copies the mesh from window 2 (after) to window 1 (before). Replaces whatever mesh was in window 1. Del Lets you delete a line from the meshes. To use, select Del, then click on the border of the picture where the line you want to remove is, as with adding a line. Press the left mouse button to delete. Select The two radio buttons shown here allow you to choose which mesh is currently selected for mesh and image options such as Max, Edit, FlipHz and others.