home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 216
/
216.d81
/
t.megamorph
< prev
next >
Wrap
Text File
|
2022-08-26
|
8KB
|
298 lines
u
Megamorph 2002
Program and Text by Ray Parrish
Those of you who saw H.A.M.S. on
issue #159 may remember the demo
animation of one dinosaur morphing
into another. I created the frames for
that animation using an old program
from Compute's Gazette called
"Megamorphs." The program did its job,
but I felt it needed a considerable
amount of work to bring it up to more
modern standards. I'll get into those
changes later.
For those who did not see the demo,
this program creates a sequence of
slides between a start image and an
end image. (Both are just plain
bitmaps.) The result won't quite look
like a Hollywood-style morph, but
rather impressive anyway. The more
expensive morphs track shapes in the
images. This program simply moves each
pixel in the start frame toward its
new position in the end frame along a
calculated path.
[Main Menu]
[---------]
From this screen you can view and
change all of the parameters for the
morph. The menu items can be selected
either by scrolling to them or hitting
the corresponding number key. Other
hotkeys in the lower half of the menu
are highlighted.
[1. Create Pixel Data & Morph]
This menu item is the heart of the
program. Before executing, it checks
to make sure you have selected start
and end images for your sequence.
Before selecting, double-check your
drive selections, image rows, and
slide number/offset. [NOTE:] Be sure
to remove existing slides and/or pixel
data files (called 'startpoints' and
'stoppoints') from the appropriate
disks to avoid errors. You may change
the Offset to add slides to a sequence
you already have on your destination
disk.
Once the process begins, the start
and end images will be loaded into
memory and mapped to disk. This is
done by going row by row, checking for
'on' pixels. The number of rows
scanned in each image is determined by
the Rows parameters on the main
screen. (Remember that each screen row
is 8 pixel rows.) The border is blue
while loading the images and red while
mapping to disk.
After the images have been mapped to
disk, Megamorph must 'equalize' the
number of 'on' points in the start
image versus the number in the end
image. Keep this in mind when choosing
your images. If there is a large
difference in the number of points,
the morph sequence will not look as
good. Border color during equalization
is yellow.
Now each frame can be rendered (green
border). Pixel coordinates are read in
from the startpoints and stoppoints
files, then run through an algorithm
to determine their new location along
the path. After each frame is
rendered, the border turns light blue
while saving it to the destination
disk.
When the morphing process has
completed, the border will flash and a
bell will sound to alert you (or wake
you up if you fell asleep while it was
running). Press any key to return to
the main menu.
[2. Morph from Existing Data]
This option works the same way as the
first menu item, but it skips the
image-mapping process. It uses the
start/stoppoints files created from a
previous morphing run to render the
frames.
After Megamorph reads through the
files to determine the number of
pixels used, it displays this number
in the status bar. Press any key to
continue from there. If no such files
exist on your Pixel Data drive, you
will be so informed on the status bar
to try again.
[3. Choose Image Files]
Here you are presented with a file
requestor showing the contents of your
source drive. The files you select
must be plain bitmaps, which are
usually 32 blocks or less. If your
images use another format, see the
short image conversion section further
down. [Choose your images wisely!]
Pictures that are very 'busy' or
heavily-dithered will not generate
nice morphs.
[4. Drive Setup]
Choose your Source, Destination, and
Pixel Data drives here. Megamorph
supports drives 8-16, and be sure not
to choose drive 14 if you have a SG
Gold printer interface. In the drive
selection menu, the right digit of
each drive number is a hotkey. '8' for
8, '0' for 10, and so on.
[5. Send Disk Command]
Choose your drive and enter the
command string. The status of the
error channel is shown in the status
bar. Due to restrictions on text
input, the ?, <, >, and other
characters cannot be entered. Hit
RETURN without entering anything to
abort.
[6. View Disk Directory]
Choose your drive, then use CRSR/
RETURN to scroll/exit.
[7. View Bitmap]
Choose your drive, then select your
image in the file requestor. (The same
guidelines as those for morph image
selection apply.) Then enter the
number of rows you wish to view.
This routine uses a manual read of
the image so that you can just view
the specified number of rows. However,
if you select the full 25 screen rows,
the image is simply loaded into memory
using whatever fastloader you may have
installed. This routine is useful for
determining how many rows of each
image you should use.
[8. Help]
View the built-in help summary.
[9. Quit]
Quit to Loadstar if it is in one of
your drives.
[Additional Hotkeys]
B - change the number of screen rows
to use in the first image.
E - change the number of screen rows
to use in the end image.
S - change the number of slides in
the morph sequence. The default value
of 2 will just recreate the first and
last image, so I recommend using a
higher number.
O - change the offset for numbering
the slides. This lets you add new
sequence to an existing set of
slides.
[Picture Conversion]
[------------------]
Megamorph expects your source images
to be bitmaps, but sometims the pics
you want to use are not in the proper
format.
To convert a DOODLE file, try this:
load"doodle file",dv,1 [RETURN]
sys57812"bit map",dv:poke193,0:poke
194,96:poke174,165;poke175,127:
sys62954 [RETURN]
For OCP Art Studio files (not
Advanced) use this:
load"ocp file pic",dv,1
[RETURN]
sys57812"bit map",dv:poke193,0:poke
194,32:poke174,165:poke175,63:
sys62954 [RETURN]
You could also use other various
programs to convert your pictures to
hi-res bitmaps.
[Recommendations]
[---------------]
With this program, the more system
power you have, the better. It [can]
be run on a stock C64 with one 1541,
but there isn't enough space left for
a large morph sequence, and it will
take a very long time to run. If you
have more than one drive, you should
use your fastest drive to store the
pixel data.
If you have a SuperCPU, you will see
a slight performance increase over
just using JiffyDOS. If you also have
at least 1 meg of SuperRAM installed,
then I suggest you use Ultramorph
(coming soon!) which stores the pixel
data in the SuperRAM for a huge speed
increase.
[Program Notes]
[-------------]
Bringing this old program up to more
modern standards took some work. In
addition to giving it a nicer menu
with a few added features, I also
cleaned up the BASIC code and modified
its data format to be easier to manage
and friendlier to drives with smaller
capacities.
Originally, Megamorphs stored the
coordinates of each 'on' point by
PRINT#ing the x-coordinate and y-
coordinate to disk. I changed the
format to store the x-coordinate in
high-byte, low-byte format, followed
by the y-coordinate in byte form. This
cut down the size of the data files
considerably.
Megamorphs also used the bitmap at
$2000 without altering BASIC pointers
to protect that space. When I decided
to add modules like Menu Toolbox III,
I had to choose a new location, $6000
in VIC bank 1.
To pack Megamorph into one file, Star
Linker wasn't totally cooperative. So
I just linked the font ML (thanks to
Font Compiler) to the BASIC code. Then
I used SledgeHammer to add the other
ML modules, finally packing it with
Datel's SuperCrunch.
RP