Copy Link
Add to Bookmark
Report
01 Issue 04
===============================================================================
Issue #4 (ARTICLE SECTION) . 0000 11 .
June 4, 1995 . 00 00 11 .
. 00 00 11 .
01 is a weekly newsletter for the demo scene. . 00 00 11 .
It is produced by the group Hornet at the site ftp.cdrom.com. . 0000 11 .
-------------------------------------------------------------------------------
Subscribers: 634 | Last Issue: 592 | Change: +42 | Size: 40,124 bytes
-------------------------------------------------------------------------------
-CONTENTS-
==[Section]=========[Article Name]=================[Author]==================
Introduction What's in This Issue? Snowman, GD, Trixter, Jeff
General 4DOS 4DEMOS: Part 2 Snowman
Music Tracking Tips IV GraveDigger
Interview with Jugi/Complex GraveDigger
Code Palette Fading and Animation Tom Verbeure
Advertisement Phluid Music Disk by ACiD
Subscribing
Closing
===[Introduction]==[Snowman, GraveDigger, Trixter, and White Noise]============
SM: Hello all, and welcome to the forth issue of 01 Article Section.
WN: Fourth? Geez, won't be able to use my fingers to count them
shortly anymore... :)
TX: You could always use your toes... but then again, that's the lazy
coder perspective. You should really own more arms.
GD: This week in o1fil, we have reviews of Naid, The Gathering, and x95
party music. Be sure to check it out!
WN: GraveDigger... is that reviews of the whole 50 something of 'em?
GD: Jeff, only the files that were uploaded to the site, of course. :)
Hey, what do we have for articles, Snow?
SM: Well, this week we start it off with the second in my series of
"4DOS 4DEMOS" tutorials.
GD: Will there be more articles in this series to follow?
SM: Heck yeah! Probably at least 8 or 10. Of course, these articles
will do little good for WN since he's such a Windows FREAK! :)
WN: I admit. I just joined Windoze Anonymous last week... :) The
first class was "I hate Bill Gates 101".
GD: You better do well in that class.. Win95 is on the way! Oh, next
is another of my Tracking Tips columns.
SM: Isn't this Tracking Tips about bloody notes?
GD: Something like that.. tracking gore! Say, Jeff, have you ever
experienced physical harm when writing a song?
WN: Well... aside from bashing my head on the keyboard when my chords
don't sound right, not really...
TX: Sounds like coding a certain sound system. Using a mallet works
better.
SM: Anyway, our next article is an interview done by GD. Brett, would
you care to give a summary?
GD: Sure.. I interviewed Jugi/Complex about a month ago and learned some
interesting things about one of the scene's older members.
WN: <whiny voice> So, I'm an old member too, how come I don't get
interviewed?
GD: dope.mod :)
SM: Next article comes to us from Tom Verbeure. Its been a while since
he last wrote for Hornet, but this article is very good.
GD: Indeed, I'm glad to see him back in the newsletter.
WN: I should really start writing something for this newsletter other
than inane comments to fill up the intros... :)
SM: How about a basic tutorial on how to get started with making your
own Home Page?
GD: That's a neat idea! And Jeff would be the perfect one to write it.
Jeff, what do you think?
WN: hmmm... Why not... some style tips wouldn't be bad...
TX: I think that would be a great idea, but make sure you emphasize proper
style: eLiTe sTufF doesn't look good under HTML. ;) Not to mention
that no one really wants to see a 1 MB GIF of their dog. :)
SM: Well folks, this has been Snowman...
GD: ...and this has been GraveDigger...
WN: ...not to forget White Noise...
TX: ...and we all love Trixter...
<>: And we are OUTTA HERE.
===[General]==[4DOS 4DEMOS: Part 2]==[Snowman]================================
_____Preparation
This article assumes you have read Part 1 of this series. Be sure to
follow all of the steps I listed there. We will be relying on them now.
Today we are going to talk about Environmental Variables and Color-Coded
Directories.
During the past two weeks, I went out and collected a lot of utilities for
ya'll. I also reorganized the directories. Instead of the files being
located under /pub/demos/utils/dos/4dos, they are now just under
/pub/demos/utils/4dos. You can also get files talked about in these
articles in /pub/demos/utils/4dos/tutor.
Here is what you need to do for today's lesson:
1. Create a directory somewhere off the root directory on your hard
drive called \STARTUP. We will be putting many cool files in here.
2. Get your favorite ascii editor ready (I prefer QEdit).
By the way, QEdit is made from the same people who bring you 4DOS:
JP Software.
[Environmental Variables]
_____Overview
Beware, the first few articles in this series are relatively simple. Don't
get caught off guard. Here is an excerpt from an upcoming article:
"...=$e[2D$e[0;34m(%%@DOSMEM[k]base) $e[0;32m(%%@XMS[k]xms)
$e[0;33m(%%@EMS[k]ems) $e[0;36m(%%@DISKFREE[c:,m]hard)
%%@IF[%@CDROM[d:] == 1,$e[1;33m(CD-ROM) ,]%%@IF[%%_MOUSE
== 1,$e[0;31m(mouse) ,]$e[0;35m(shell $z) $e[0;37m $_$p$g..."
So as you can see, there's a lot to be covered before we get to that point.
Anyway, on to the lesson for today...
Many programs require environmental variables. Common examples would
include "ULTRASND=240,1,1,11,7" and "BLASTER=A220 I7 D1 T2". We do not
want to have these cluttering up your AUTOEXEC.BAT file. Its time for
them to grow up and leave. Its time for SET_ENVS.BAT!
_____Make It So
OK, we know that we want a file called SET_ENVS.BAT and we want it to
be located under \STARTUP. But what does SET_ENVS.BAT look like?
For starters, you need to make a standard header block. This is just a bit
of text that you stick at the top of each file explaining what it is.
Here is my personal header block:
: File Name : SET_ENVS.BAT
: Title : Set Environmental Variables
: Author : Christopher G. Mann
: Last Modification : May 30, 1995
: Purpose : Configure environment for different applications.
All of my batch files follow this format. Notice that each line begins
with a ":". This is the same thing as a REM, but its much cleaner in my
opinion.
Next we want to list the environmental variables. However, when we run
this file, we don't want everything to be displayed to the screen. We
want to just type SET_ENVS and go! So the next two lines are:
: Don't echo anything
@echo off
The ": Don't echo anything" is just a comment. I suggest you use them
often. Trust me, in a few months you'll go back to modify a file and not
have any idea why you did something.
Last, but not least, we list our environmental variables. Open up both
your AUTOEXEC.BAT and SET_ENVS.BAT files and start cutting and pasting.
When you are done, your AUTOEXEC.BAT file should contain _no_ "SET"
statements.
Here are a few of my variables:
SET BLASTER=A220 I7 D1 T2
SET CAPAMOD=/pan33 /fde0 /lop0 /md01 /rnd /clr1
SET NU=C:\NU
SET TEMP=C:\TMP
SET ULTRADIR=C:\US
SET ULTRASND=240,1,1,11,7
The last step is to have SET_ENVS.BAT called every time you start your
machine. We can do this by adding one line to your AUTOEXEC.BAT file:
CALL C:\STARTUP\SET_ENVS.BAT
Now your system is cleaner and more organized. Please do not skip over
making this file. We will be adding a lot to it later (when we start
working on aliases).
[Color-Coded Directories]
_____Overview
Wouldn't it be nice to have all of your GIF and JPG files appear in blue
and your MOD and S3M files in green? With a quick glance, you can easily
identify any type of file. Color-coded directories will save time and make
your system look a lot more groovy! :)
_____Make It So
We need to make a new file. What is it called? It's SET_COLS.BAT! And
where are we going to put it? Yippers, in \STARTUP.
At this point, you might be noticing a trend. Right now, I have 5
SET_XXXX.BAT files in my \STARTUP directory. By the time I'm done writing
this series there might have a couple more.
Here is my header block for this file:
: File Name : SET_COLS.BAT
: Title : Color Directory Configuration for 4DOS
: Author : Christopher G. Mann
: Last Modification : May 30, 1995
: Purpose : This file contains a list of common file extensions
: : and the colors those files should be displayed as
: : when a "dir" is requested.
And we don't want this file to echo either so add:
: Don't echo anything
@echo off
Here is a list of my own color-coded files (slightly condensed):
: Archive
set colordir=arj zip lzh lha a0?: cyan;
: Batch Files
set colordir=%colordir%bat btm: red;
: Code
set colordir=%colordir%c h asm hpp cpp pas bas scr:bright cyan;
set colordir=%colordir%obj tms: white;
: Directories
set colordir=%colordir%dirs:blue;
: Executables
set colordir=%colordir%com exe: bright red;
: Graphics
set colordir=%colordir%gif jpg lbm pcx tga wpg: bright magenta;
: Music
set colordir=%colordir%669 amf far mod mtm ptm s3m xm:bright blue;
: System
set colordir=%colordir%drv sys: bright green;
: Text
set colordir=%colordir%1st doc me nfo txt:green;
For a list of color names, just type "HELP COLORS" at your 4DOS prompt.
You'll notice that my first set is "set colordir=arj zip..." and the second
one is "set colordir=%colordir%bat btm...". Why do we have that
"%colordir%" thingie in there? Well, we are working with 1 variable here,
the "colordir" variable. If you were to type:
set colordir=Snowman
set colordir=can't track music.
then the value of colordir would be "can't track music" because you
reset the variable when you entered a new value. We get around this by
typing:
set colordir=Snowman
set colordir=%colordir% can't track music.
That little "%colordir%" means 'take the original value of colordir and
put it before the rest of this line'. So after typing the above two lines,
the value of colordir is "Snowman can't track music."
Just like with SET_ENVS.BAT, we want this file to be called automatically
every time we boot our machine. So add the following line to your
AUTOEXEC.BAT file:
CALL C:\STARTUP\SET_COLS.BAT
You might be thinking "Hey, we are using 'set colordir'. Why didn't that
go in our SET_ENVS.BAT file?" Well, I'm not going to tell you. Its a
secret.
[Wrapping Up]
OK, now your system has Color-Coded directories and Environmental Variables
all organized and tidy. But wait! All of that stuff eats up memory. Are
you going to run out? Well, last week I told you to add the line:
SHELL=C:\4DOS\4DOS.COM C:\4DOS /P /E:1024
to your CONFIG.SYS file. The "/E:1024" means 'allocate 1024 bytes for
environmental memory'. You can check to see how much you have left simply
by typing MEMORY from your 4DOS prompt.
Here is what mine looks like:
655,360 bytes total DOS RAM
635,280 bytes free <--- and I'm not even using QEMM!
1,843,200 bytes free XMS memory (HMA in use)
2,048 bytes total environment
575 bytes free <--- I still have 575 bytes left
2,048 bytes total alias
873 bytes free
1,024 bytes total history
If you notice that your environment space is running low, then simply
increase the "/E:xxxx" parameter above to accommodate. Mine is currently
set to 2048, but its unlikely at this point that you will need more than
that.
Well, now you have fancy colors and your environmental variables all set.
Next issue, we'll talk about ALIASES, PATH, and CDPATH. This will bring
the number of SET_XXXX.BAT files up to four. The fifth file will be
SET_PROM.BAT, entitled "The Ultimate Prompt". This will utilize a lot of
internal 4DOS calls so we'll put it off until the forth installment of this
series. Until then, take care everyone.
And remember, 4DOS 4EVER!
-Christopher G. Mann r3cgm@ftp.cdrom.com
===[Music]==[Tracking Tips IV: Note Bleeding]==[GraveDigger]==================
"Note Bleeding" is just a fancy name I came up with for fading one note out
while fading another in, causing the two notes to "bleed" into each other.
I find it to be most effective on looped string instruments, but it can be
useful for other sounds as well.
What this does is change the current note value without the bumpy transition
of simply re-sounding the note. Doing that can even be dangerous if your
sample does not have a fast attack and no offset command is used. So, using
this "bleeding" technique provides a gentle note change with a nice smooth
transition. Below is the tracker example:
Before: After:
| Channel 1 | Channel 2 | | Channel 1 | Channel 2 |
|C-4 01 64 ...|... .. .. ...| |C-4 01 64 ...|... .. .. ...|
|... .. .. ...|... .. .. ...| |... .. .. ...|... .. .. ...|
|G-4 01 64 ...|... .. .. ...| |... .. 48 ...|G-4 01 16 ...|
|... .. .. ...|... .. .. ...| |... .. 32 ...|... .. 32 ...|
|... .. .. ...|... .. .. ...| |... .. 00 ...|... .. 64 ...|
In the first example, you have a standard note change. In the second
example, the first note fades out as the second note fades in. Tip: use
more rows to gradually change the volumes. This will create a much smoother
effect. I just used five rows to save space. :)
Also take note that the sum of the volumes between the two "bleeding"
channels is always the same, from the initial note attack all the way
through the crossover. This will create a very smooth "bleed."
The next article begins a two-part "Melody Variations" section.
===[Music]==[Interview with Jugi of Complex]==[GraveDigger]===================
Jugi is a musician in the group Complex. Complex recently won first place at
The Gathering '95 with their demo entitled "Dope." Other popular Complex PC
releases include "Cyboman" and "Cyboman 2", two awesome intros.
In our last issue of o1art, Reward and Jmagic of Complex were interviewed.
If you haven't seen it yet, be sure to get a copy and read it.
Complex also promises to present a demo at Assembly '95. I'm sure it will be
another fascinating presentation.
Since Jugi and myself live on different continents, our time differences
prevented an interview on IRC for some time. Eventually we met up, and the
conversation that took place follows. The interview took place on Monday,
May 8, 1995 from approximately 8:00am to 8:30am EDT.
----------------------------------------------------------------------------
JG - Jukka Kaartinen of Complex jusaka@tarzan.math.jyu.fi
GD - Brett Neely of Hornet gd@ftp.cdrom.com
----------------------------------------------------------------------------
GD: Hello! Could you tell us your name, age, where you live, where you go
to school, and work?
JG: My real name is Jukka Kaartinen. I'm 22-years-old. I study in the
University of Jyvaskyla... I study computer science, physics and
multimedia. I also do some freelancer gfx work for one company... :)
GD: Do you wear glasses or contacts?
JG: I wear glasses. :) I'm too lazy for contacts.
GD: When did you attend your first demoparty?
JG: I was at my first party in '88. It was a small party in the middle of
the woods... in an old school house. It was held by Byterapers.
GD: How many people were there?
JG: About 30... There were lotsa c64s and some Amigas...
GD: Any PC's?
JG: Nope...
I had already made a game on the c64, and I had a preview of that at the
party... and I think I released one picture there too. Made with a c64.
It was 320x200, 2 colors.
GD: What kind of game had you made?
JG: The game was an Uridium clone type of shootemup... we sold it to this
English budget game company called CRL, but it went bankrupt before we
got the money from it. But it was a really cool game... I did gfx and
music for it, and my friend coded it. We worked on it for about 1.5
years.
GD: That's too bad you didn't get money for it. :( I also used to have a
c64 - wish I could have seen the game. :>
When did you first come in contact with Complex?
JG: Well.. I'm gonna tell ya older stories now! :)
GD: Ok :)
JG: Back in 1990 I was at one lame party... I needed a ride back home, so
I got it from Mic Dair (leader/organizer of Complex) and Cable (old
amiga coder) and I joined Complex then :) I think Reward joined Complex
in 1992, since he wanted to get in free for Assembly '92 which we were
"organizing" as a name only...
GD: Hehe, now there's a good reason to join a demo group. :)
JG: That was the way he could get in drunk & free. :)
GD: When did Jmagic join?
JG: Hm.. I try to remember. It was after he won at The Party '93... I knew
him thru Trav (of Complex maybe) :) and Trav is an old friend of
Saviour / Complex (famous elfmania coder). Anyway, I thought... lets
have a PC section, and that was ok with Mic Dair, so we did it.
So Jmagic started to work with us. Since Jmagic is from this town
(Jyvaskyla city; the place where I study) we could work very closely.
GD: It's important to be able to get together for this kind of thing; you
are lucky to be near each other.
At The Gathering 95, "Dope" won first place.. congratulations to all
of Complex for that. :)
JG: Err. Thank you :)
GD: How long did the entire "Dope" process take?
JG: Well... we put it together in little over a week. I mean... the routines
were ready for about two months or so.. Jmagic had worked on them little
by little, then we thought... "now we are gonna make a demo." First we
just talked and bullshitted about it... and then we realized that there
was only 1 week to go!
GD: Why is it that the greatest demoparty entries are made in such a short
amount of time? :) How long did it take to write the music?
JG: I had been working on the tune for about a week then.. and it was nothing
yet. So, a little over 2 weeks, but its hard to tell.. cuz I can't
remember how many hours i used on it. I might have worked 5 hours one
day... 0 hours the next... etc.
GD: Which came first.. dope.mod or onward.xm?
JG: I did onward.xm at the party place in 20 minutes from the "Dope" tune.
GD: Oh ;)
JG: Anyway.. the gfx in dope were done like... ultra fast. I just
photoshopped/3ds'ed some shit and put it there. We ran out of time so
badly. I had to send the "routine boxes" to Reward to be dithered.
They were all 3ds... and the desert at the end was just a fast scan :)
All the movements of the objects from envmap to the end was made by
jmagic in about 10 mins. so it wasn't quite what I wanted. The thing
is... we deliberately made the demo so that it would be lightning fast
to design. We used the old amiga trick "routine boxes"... routine
after routine... boasting about them with these "little" annoying
boxes.
GD: I like those little annoying boxes :>
JG: The amiga scene has had its share of those kinda demos, so we thought
this would be the first to do it with the PC. There's no grand design in
this demo.... just routines routines routines. That's its purpose.
It feels so funny when people make such a big fuss about Dope when I
know its some routines put together in a little over a week.
I know that PC doods like those "movie" like demos where some guy jumps
off of a plane without a reason :)... etc... and spaceships fly and you
feel like you were in a low budget scifi movie.
GD: In my opinion, a demo doesn't need a story to be good, it just needs
to be original.
JG: Anyway this is no movie... its a demo of coding skills in a nice packet.
We are in the process of making a demo where you couldn't instantly tell
"this a scene demo". No obscure logos flashing on the screen... no
routine "boasting"... but something like a beautiful scenery "movie"
with something that will awake your "sense of wonder"... lets just hope
we have time and inspiration to finish it... and then you can Dive with
us...
GD: Can't wait to see that!
Complex's two "Cyboman" intros helped get your group into the Imphobia
charts. How much work went into these intros?
JG: Cyboman2 was about 1 week. I directed it half the way, with Jmagic in
Jyvaskyla. But when I saw the final version at the party it wasn't good
enough so we fixed the rest of it at the party.
GD: Personally, I think the "Dope" music really tops off the demo... the
music is so original and fitting with the graphics.
JG: Ok.. lets talk about the music. The tune was actually made to fit the
demo. :)
GD: There's only one thing I don't like in dope.mod :) There's a bass note
that sustains too long, i think.. about 6 minutes through the song.
JG: Well... heh... at that point I had left for the PARTY! The "envmap"
part of the song was made at the party and it defiantly suxx
bigtime... regular loop collection.
GD: But i really like the organ melody...
JG: I have to say this... the "main" part of the tune which has the melody
is the _real_ dope music... the beginning... the "tv scifi:)" sounding
part is just something i put together to fill the beginning of the demo.
Cliche.
GD: Right.. the sounds go well with the scrolling "Complex" logo, though.
JG: Well.. the music syncing is kinda of joke in dope since it depends on how
fast your HD is. Music is started at the beginning, stopped in the end.
There's no interaction between the music player and demo code.
About the mod, 28 channels is nothing. Lets go thru them: 5 channels
for drums&percussion, 9 channels for the humming sound, 2 channels
for the bass "guitar", then the organ chords and their echos take 6
channels, the lead and its echoes takes 4 channels. It goes something
like that...
... Anyway... that's how you can spend channels. Of course I could have
taken off like 8 channels or so if I had all the chords sampled, etc, but
it was the "development" version of the mod that was in the demo.
GD: That's true...
JG: I could fix the tune now that I know what it should sound like. I had no
time to "optimize"... besides... I had no need to. :) One more thing. It
doesn't say in your favorite music CD how many channels were used. :)
Music is music, technique is technique.
GD: Good answer. :)
Do you use any other tracker besides FT2?
JG: Ok.. trackers. I only use FT2 and Protracker on Amiga.
GD: Do you have any music theory training?
JG: Well... I've played keyboards for 13 years now. I've never received
classical training... but I do play a lot and compose. My piano playing
style is like.. Tori Amos/Bruce Horsby with a touch of Chick Corea in it.
GD: Ah.. how often do you play the piano?
JG: I play everyday. The piano is my favorite instrument (of the ones I can
play :)...
GD: What kind of instruments do you have? Any keyboards/synths?
JG: Well, my midi setup is poor and small :) I have a u-20 & 03r/w. I have
a Korg 16 channel mixer... and I have a dx-100 too! :) But luckily my
flatmate has a piano.
GD: You have a dx100 computer?
JG: Nope, Yamaha dx-100. Little thingie fm-synthesizer... and I have access
to a piano. My flatmates(hello Anita:)) piano is in the kitchen.
GD: A piano in the kitchen? :)
JG: Yes. :)
GD: What kind of computer setup do you have?
JG: HEHEH... Don't ask. :)
GD: C'mon, I'm sure my setup is far worse than yours. :)
JG: Well.. i have an Amiga 1200 and a 486dx - 33 true IBM valuepoint. :)
GD: Ah. (See, I was right =)
JG: But i will have a new Pentium 100 reaaally soon.. so :)
GD: Have you had any art training?
JG: Hmm.. its been like 4 or 5 years since i've last drawn on paper. I mean
really trained... I do sketches sometimes... but thats rare too. I've
been doing computer gfx actively since early '87 so I'm very familiar
working the whole gfx process within computers.
GD: What do you hope to be doing in 5 years from now?
JG: Making my own music.. thats my dream :) but a more realistic thing
for me is to be working in all different kinds of multimedia projects.
I'll be a master of science in electronic media when (and if;)) I
graduate.
GD: That sounds interesting... good luck with it!
JG: There would be a zillion things to tell about the scene since I've
been watching it for so long, but lets not bore our readers :)
GD: Good point... let's get going... is there anyone you want to greet?
JG: Greetings... well... um... everybody on the net :) btw... if anyone
wants to check out some stuff I've made during my sceneyears, check
out my homepage which is: http://www.math.jyu.fi/~jusaka/
GD: Anything else you want to say before we go?
JG: Yes... Dope was nothing... there's more to come. Much more. :)
GD: Can't wait to see it. :)
JG: Ok.. I think that's it.
GD: Thanks for taking the time to do this interview!
JG: 'tis ok. Later.
==[Code]==[Palette Fading and Animation]==[Tom Verbeure]=======================
After my last article about Pentium floating-point optimization, a lot of
people told me it was too difficult, so this time something easier.
A standard VGA card can display only 256 colors at once. Each of these 256
colors can be chosen individually out of 262,144 colors. You all know this,
and most of the time, it is being regarded as a severe restriction, which
is why 15-bit or 24-bit SVGA card are so popular. Paletted screenmodes have
some advantages over their true-color brothers that are especially
interesting in demos:
* they require less memory for the same number of pixels.
* one can change pixels with the same color to another color by
just changing the palette value.
Both features are a major plus for high-speed effects.
The last feature is especially useful during fading of images, probably one
of the most used 'effects' in demos. Instead of having to change the RGB
values for every pixel, one has to change only the palette. Again, nothing
new here.
Less known is the fact that relatively complex looking animations can be
made by simply changing the palette. The worm-hole in Unreal and the
background of the 'Scrollers Suck' part in Panic, both demos of Future Crew
are a nice example of this. Another one is a part in The Good, the Bad and
the Ugly of Surprise!Productions where a logo of S!P is scrolling up-right
in the background while some 2D signs are constantly transforming into each
other. (Of course, everybody has seen DejaVu from Synergy Design with a
rip-off of the wormhole :-) ).
All these effects share some common characteristics:
- They have very few colors
- Repetitive animations
- frequency of repetition is fast.
How is this being done? They just change the palette, sometimes with a
small action on the foreground (like the transforming 2D's in TGTB&TU).
Suppose you have 2 pictures with different colors and you would want to
change between them by just changing the palette (of 256 color-entries).
Suppose we are in a worst case situation where every color combination
exists. Let N and M be the number of different colors in images A and B.
Then N*M must be smaller than 256! So, in a worst case, one can show 2
different images by only changing palette when both images have 16 colors.
This worst case happens most when using scanned pictures, because there are
no large areas with the same color. Not being in the worst case, means that
there are less color combinations (e.g. one never has to change from a
color X in image A to a color Y in image B). An extreme example of an
optimal case is... standard fading of an image: in this case, EVERY pixel
with color X is mapped to color Y (with color Y being a color X multiplied
by a certain factor) and never to another color !
An example will make this clear: Suppose we want to combine two images A
and B into one bitmap with two palettes.
image A image B
.....= *.....
....=. .*....
...=.. ..*...
..=... ...*..
.=.... ....*.
=..... .....*
Then one possible solution is this:
image C
100002 Palette to show image A: Palette to show image B:
010020 color 0 = '.' color 0 = '.'
001200 color 1 = '.' color 1 = '*'
002100 color 2 = '=' color 2 = '.'
020010
200001
Notice that we need only 3 colors in our palette because the combination
'=' -> '*' doesn't exist. We are not in a worst case situation.
Now comes the question of how to create the palettes and the bitmap to
change between the images. Actually, this is very easy: here is the
algorithm in pseudo-language:
P[256] : array of color combinations (C1,C2)
Pal1[256] : resulting palette to show image A
Pal2[256] : resulting palette to show image B
Image C : resulting image, containing both image A and image B
I : intermediate value
Empty P
Load Image A
Load Image B
For every pixelposition (x,y)
Get colornumber A at (x,y) of image A
Get colornumber B at (x,y) of image B
Search colorcombination (A,B) in P.
if (A,B) already in P
I = position of (A,B) in P
else
Add colorcombination (A,B) to P
if P is full (more than 256 color combinations)
print "Oops. Too many combinations..."
abort
I = position of (A,B) in P
end if
Put I at position (x,y) of destination image C
end for
Load Palette A
Load Palette B
For every combination C in P
Get A-part of the combination C
Get (R,G,B) triple from Palette A at position of C
Put (R,G,B) triple in Pal1 at position of C
Get B-part of the combination C
Get (R,G,B) triple from Palette B at position C
Put (R,G,B) triple in Pal2 at position C
end for
Write Image C
Write Palette 1
Write Palette 2
Voila. That's it!
The pseudo-code to show both images it too simple, here it is anyway:
Load Image C
Load Palette 1
Load Palette 2
Black Palette
Put Image C on screen
Set Palette 1
-- Image A is now visible
Set Palette 2
-- Image B is now visible
Until now, nothing exciting... Just putting the right image and palette
would result in the same 'effect', but with much more colors possible and
much easier, only not as fast. We haven't gained almost anything, yes? But
wait, other things are possible: perfect cross fades between two images can
be done by interpolating between colors of Palette 1 and 2:
Load Image C
Load Palette 1
Load Palette 2
Palette I : intermediate cross-fade palette
TI : intermediate color
Black Palette
Put Image C on screen
For t = 0.0 to 1.0 step 0.1
For C = 0 to 256
Get RGB triple T1 at position C in palette 1
Get RGB triple T2 at position C in palette 2
TI.R = (1.0-t)*T1.R + t*T2.R
TI.G = (1.0-t)*T1.G + t*T2.G
TI.B = (1.0-t)*T1.B + t*T2.B
Put RGB triple TI at position C in palette I
end for
Set Palette I
end for
Result: a perfect cross-fade between image A and B in 10 steps. Please use
fixed integers for the multiplication (even on a Pentium :) ) or a
multiplication table and rework the equations to T=A-t*(A+B), eliminating
one multiplication.
This technique doesn't have to be restricted to two images: as long as the
number of color combinations stays below 256, extra frames can be added.
Unfortunately, this number increases rapidly in animations.
Let's show this with a worst case example of 4 images: Let N1,...,N4 be the
number of colors for images 1 to 4, then N1*N2*N3*N4 must be lower than
256. When N1==N2==N3==N4, this means that N1 is equal to only 4 !!! A
theoretical maximum number of frames in worse case is 8 frames, with 2
colors for each frame. To make things worse, as the number of images
increases, the chance of having a worst case situation increases also.
For those of you who want it described in mathematical terms:
C=N^M (worst case) and C<= 256
with C the number of color combinations, M images and N colors for each
image.
Now, we are able to explain the three characteristics of the effects in the
different demos:
- They have very few colors
Logical, it is desirable to have at least 4 frames in the animation,
giving, worst case, only 4 colors...
- Repetitive animations
No repetition means... lot of frames. Out of the question...
- frequency of repetition is fast.
I like this one: contrary to most demo-effects, it is just impossible to
create slowly moving effects, because they need more frames :-) ! One can
of course create 2 or more images that combine 8 images each.
Initially, I thought that using this technique would decrease required disk
storage. For uncompressed cases, this is true indeed: for 8 frames, one
needs 8 times less space (when using 1 byte for each pixel). When
compressing, this doesn't hold anymore: even bad compression algorithms
have a compression factor of more than 8 for 2-color images. The combined
image however generally has less repetitive sequences AND requires an extra
786 bytes for each frame to store the palette.
Related articles:
VGA Palette Mapping Using BSP-Trees, Mark Betz, Doctor Dobbs Journal,
Jul 93
-Tom Verbeure Synergy Design/The Natives
==[Advertisement]==[Phluid Music Disk by ACiD]=================================
-= A-C-i-D - P-R-O-D-U-C-T-I-O-N-S - P-R-E-S-E-N-T-S =-
______________________________________________________________________________
.p. .H. .l. .u. .i. .d. .M. .u. .s. .i. .c. .D. .i. .s. .k.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-=-
The first ACiD music disk entitled pHluid, will be available (as of June
3rd) on a monthly basis at ftp.cdrom.com, peace.wit.com, and various other
demo related sites. Also released will be the first version of the pH
music player. Features will include:
- Best S3M routines available. (no Ultra-click)
- Supports GUS, GUS MAX, Sound Blaster and compatible cards.
- Full stereo panning using the S8x and Xxx commands.
- LST file support.
- Multi-screen environment.
- Customizable for independent releases (*)
- Automatically jumps to next song in .LST file. Just sit back, relax and
listen to the music as if it were a CD.
* Future release will include maintainance utility to swap interface gfx
and customize fonts, colors, and intro screen.
______________________________________________________________________________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This month's has over one full hour of music including songs by Basehead <fm>,
pinion <ACiD/Lucid>, Stalker <OTM>, Protocol <ACiD>, Rimbo <ACiD/Lucid>,
Psibelius <Epi/ACiD/TW>, Pianoman <ACiD>, and Beaner <ACiD/CiA>. Also,
Original interface artwork by ACiD's own Cat.
-=-
This is one of the most ambitious music disk projects to ever be undertaken.
Our goal with pHluid is to offer the highest quality music to the scene on a
reliable monthly basis. We got tired of never knowing when or where the next
new release was going to be. That's why pHluid was formed... to offer a
regular supply of quality music in one production.
______________________________________________________________________________
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If your interested in being a part of the pHulid production, or have any
comments or suggestions, then email pinion at: pinion@acid.extern.ucsd.edu
===[Subscribing]===============================================================
There are three public newsletters produced by Hornet:
demuan-list Listing of new files on ftp.cdrom.com /pub/demos.
This is really the home-base list. If you subscribe
to only 1 of newsletters we offer, make it this one.
demuan-article This newsletter has timely articles dealing with many
aspects of the demo scene. This is a serious newsletter
and not to be confused with hornet-news.
hornet-news Hornet News is an informal newsletter. There are
editorials, opinion columns, and humor dealing with
many aspects of the demo scene.
How to Subscribe:
1. Start an e-mail to: listserver@unseen.aztec.co.za
2. Type in "blahblah" as the subject. The listserver does not read
the subject line, but I do not know what will happen if you
leave it blank.
3. On the first line of the body of the mail, write:
subscribe demuan-list YourName OR
subscribe demuan-article YourName OR
subscribe hornet-news YourName
In place of "YourName", use your real name or handle. Your name
can be 1 or 2 words long.
Example:
subscribe demuan-article Christopher Mann
subscribe demuan-article r3cgm@dax.cc.uakron.edu !WRONG!
4. Send it.
The listserver will automatically look at the return address of your
mail. _That_ address is where newsletters will be sent.
===[Closing]===================================================================
For questions and comments, you can contact us at:
Jeff | jeff@ftp.cdrom.com - general stuff, WWW, NAID96 organizer
Snowman | r3cgm@ftp.cdrom.com - unusual stuff, o1 + HNews newsletters
GraveDigger | gd@ftp.cdrom.com - music + demo reviews, general music
Trixter | trixter@ftp.cdrom.com - code reviews, general code
Dan Wright | dmw@inca.gate.net - Freedom CD
===============================================================================