```
7 00172 scrmt321.zip 1 00426 ft206.zip 1 00152 ggouro2.zip
8 00161 it105.zip 2 00234 cp16.zip 2 00119 dcc_3de.zip
9 00161 ft204.zip 3 00172 scrmt321.zip 3 00115 dn116_3d.zip
4 00161 it105.zip 4 00097 pmw122.zip
5 00090 s64.zip
```
=-[Uploads]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=----------------------------------------------------------[File Information]-=
All files listed below are on ftp.cdrom.com under /pub/demos.
Please keep in mind that all ratings are subjective.
If your file transfers are too slow, there are several alternatives:
Our code mirror is ftp.co.iup.edu/code. ftpadmin@ftp.co.iup.edu for help.
Try getting files from the web at http://www.cdrom.com/pub/demos
See /hornet/demonews/demonews.102 for details about ftpmail.
You may also wish to check out a couple of other good demo sites:
ftp://ftp.arosnet.se/e:\demo maintained by Zodiak / Cascada
ftp://hagar.arts.kuleuven.ac.be/demos maintained by Sleeping Dog / Natives
Here are also a few good WWW links to try out (under construction):
http://www.th-zwickau.de/~maz/sound.html for music and sound utils
=-------------------------------------------------------------[Demos:General]-=
Location /demos/alpha Size Rated Description
=-------------------------------- ---- ----- ---------------------------------=
/1996/d/distant.zip 5 **** Distant by Remal
/1996/j/jump_n.zip 208 *+ Jump by Nova
=-------------------------------------------------------------[Music:General]-=
Location /demos/music Size Rated Description
=-------------------------------- ---- ----- ---------------------------------=
/disks/1996/m/myst0296.zip 1239 ***+ Mystique Music Disk 02/96
/songs/1994/mod/f/fullmoon.zip 163 ** Full Moon Rock by Heatbeat
/songs/1994/mod/i/iridium.zip 247 *** Iridium by Misty and Daeron
/songs/1994/mod/k/killingf.zip 96 ***+ Killing Floor v2.1 by Chorus+Sid
/songs/1994/mod/m/mypolska.zip 114 **** Myonnytspolska by Dizzy
/songs/1994/mod/n/netherwd.zip 293 ***+ Netherworld by Probe
/songs/1994/mod/n/nk_acid2.zip 144 *** Acid Jazz (pt 2) by Nuke
/songs/1994/mod/n/nocorner.zip 67 **+ No Corners by The Master
/songs/1995/mod/d/deci.zip 247 * Deci by T.U.O
/songs/1995/mod/j/julius.zip 289 ***+ Julius! by Julius
/songs/1995/s3m/g/ghost.zip 116 ** Celes.Mel. by Zaigamor Spellweaver
/songs/1995/s3m/v/vibrphns.zip 77 *** Vibraphones by Julien Lariviere
/songs/1995/xm/h/h2-brght.zip 238 * Bright Green World by Trajic
/songs/1995/xm/i/ineed.zip 563 *** I Need the Actions by Lizardking
/songs/1995/xm/l/lk_indi.zip 715 * Elvis E. Ind. by LK+Ante Lundgren
/songs/1995/xm/l/lk_infer.zip 417 ***+ Inferno Dance by Lizardking
/songs/1995/xm/l/lk_sat.zip 715 * Saturday Night by Lizardking
/songs/1995/xm/p/physiogn.zip 293 ***+ Physiognomy by Trajic
/songs/1996/it/j/joint.zip 136 *+ Joint by Galahad
/songs/1996/it/n/no-secon.zip 107 *** Second Sight by Delta X
/songs/1996/it/v/vs_tefth.zip 232 ***+ The Soul Tefth by Vadim VS
/songs/1996/mod/d/dem-fl.zip 70 ***+ Flatloop by ???
/songs/1996/mod/d/dieindus.zip 76 *** Die Industry by Frelancer
/songs/1996/mod/d/dream_s1.lha 204 ** Dream Sequence Part 1 by Hypno
/songs/1996/mod/d/dream_s2.lha 95 *** Dream Sequence Part 2 by Hypno
/songs/1996/mod/d/dream_s3.lha 100 **+ Dream Sequence Part 3 by Hypno
/songs/1996/mod/h/heavenp.zip 51 ** Heaven of Pain by Madokan
/songs/1996/mod/m/mars.zip 97 ** Mars Power by Michiru
/songs/1996/mod/v/venus.zip 96 **+ Venus Power by Michiru
/songs/1996/s3m/g/g_gcntri.zip 131 ***+ Centauri Grey by GentlE
/songs/1996/s3m/g/gals.zip 112 ***+ Gals Spakoz by Zenecade
/songs/1996/s3m/g/gf_alway.zip 97 ***+ Always Dark by Ghost Fellow
/songs/1996/s3m/g/gf_depen.zip 121 ***+ Dependance by Ghost Fellow
/songs/1996/s3m/g/gf_heave.zip 162 **** Heaven is So Far by Ghost Fellow
/songs/1996/s3m/g/gf_inter.zip 77 **** Interstice by Ghost Fellow
/songs/1996/s3m/g/gf_lost.zip 150 *** Lost Soul by Ghost Fellow
/songs/1996/s3m/g/gf_space.zip 117 *** Space Killer by Ghost Fellow
/songs/1996/s3m/g/gf_techn.zip 137 *** Tech Not! by Ghost Fellow
/songs/1996/s3m/g/gf_willb.zip 76 ***+ This Will Be by Ghost Fellow
/songs/1996/s3m/i/icefirst.zip 262 + Think About.. by George Gaspari
/songs/1996/s3m/l/lush.zip 138 ***+ Lush Forests by Zaig. Spellweaver
/songs/1996/s3m/m/m-river.zip 137 **+ River of Sadness by Guizmo
/songs/1996/s3m/m/m-rnr.zip 177 *** R'n'R by Uterere
/songs/1996/s3m/m/m-spell.zip 197 **+ Gypsy's Spell by Guizmo
/songs/1996/s3m/m/m-war.zip 263 *** WarCraft by Guizmo
/songs/1996/s3m/m/meta.zip 59 *** Metamorphica by Zenecade
/songs/1996/s3m/n/no-knife.zip 67 **+ CutThroat by SamH
/songs/1996/s3m/n/no-var-p.zip 217 **+ Variable-P by Syrinx
/songs/1996/s3m/n/no-zjump.zip 292 ***+ Zydeco Jump by Stote
/songs/1996/s3m/p/pr-adjst.zip 221 ***+ Adjustments by Darkwolf
/songs/1996/s3m/p/pr-aware.zip 143 *** Awareness by Darkwolf
/songs/1996/s3m/v/v-river.zip 116 **+ The River Eternal by Vegas
/songs/1996/xm/e/echnaton.zip 244 * Echnaton by Scolnick
/songs/1996/xm/g/gl-night.arj 618 *** Forever Night by Glitch
/songs/1996/xm/h/holyhell.zip 215 *+ Holyhell by ???
/songs/1996/xm/h/htime.zip 415 ** House Time by Trauma
/songs/1996/xm/l/ladybug.zip 168 ** Ladybug by Scolnick
/songs/1996/xm/l/leggmatt.zip 529 *+ Leggematter'n by Xerxes
/songs/1996/xm/m/ms_hfl.zip 83 **+ Heart Full of Love by Miss Saigon
/songs/1996/xm/m/myrose.zip 262 ***+ My Rose by Nedeljko Gajic
/songs/1996/xm/n/ng-lcyc.zip 384 **+ Lunar Cycle by Solaris
/songs/1996/xm/n/ng-ondat.zip 178 **+ Ondated by Demuc
/songs/1996/xm/n/ng-rad.zip 326 *** Radition by Cicada
/songs/1996/xm/n/no-feuil.zip 350 **** Feuilles Mortes by Spyder
/songs/1996/xm/v/vs_feb9.zip 326 **+ February 9th by Vadim VS
=----------------------------------------------------------[Graphics:General]-=
Location /demos/graphics Size Rated Description
=-------------------------------- ---- ----- ---------------------------------=
/images/1996/l/lt-appol.zip 170 *** Dance with the Planets by Light
=-----------------------------------------------------[Graphics:Non-Reviewed]-=
Location /demos/graphics Size Description
=-------------------------------- ---- ---------------------------------------=
/programs/players/cybrshow.zip 1417 Fractal Arts by Cyberlight Matrix
=----------------------------------------------------------------------[Code]-=
Location /demos/code Size Rated Lang Description
=-------------------------------- ---- ----- ---- ----------------------------=
/demosrc/micsrc41.zip 185 **+ A--- BBS intro w/environ. mapping
/graph/3d/vga-vul3.zip 14 **+ A--P How to do simple 3D
/graph/3d/vga-vul4.zip 9 *** A--- Simple 3D in ASM
/graph/examples/bp-hires.zip 14 ** A--- 640x480x16 by Ash/Bunghole
/graph/fade/vga-vul2.zip 20 *** A--- ASM source on palette fading
/graph/gouraud/gvector2.zip 73 *** --C- Gouraud vectors by Tumblin'
/graph/stars/vga-vul5.zip 10 *** A--P How to do a simple starfield
/libs/adip.zip 708 ** ABCP SB Awe 32 developers pack
/libs/asm_good.zip 118 ***+ A--- Lots of misc. ASM code
/pmode/pmw122.zip 127 ****+ --C- Pmode/W v. 1.22 by DD/Ren.
/sound/cpmik02.zip 18 ** A--- S3M/GUS player
/sound/fmoddoc2.zip 390 ***** --C- Great MOD/S3M/player info!
/sound/mxmp12.zip 92 **** A-C- Tiny .XM/GUS player by Cubic
/text/ffmts002.zip 102 ***+ ---- Music file formats info.
/text/vga-info.zip 139 ***+ ---- Graphical pragmatics via VGA
/tutorial/basicdoc.zip 4 *** ---- Beginner's guide to VGA
/tutorial/dn114_3d.zip 14 ****+ --CP Intro to 3D by Kiwidog
/tutorial/fh-3dtut.zip 12 ***+ A--P 3D vector tutorial
/tutorial/kmagv2.zip 54 **+ A--P King's programming mag. #2
/tutorial/kmagv3.zip 63 *** A-CP King's programming mag. #3
/tutorial/tweakdoc.zip 5 ***+ ---- Beginner's guide to Mode X
/utils/alabv12.zip 185 ****+ A--- ASM IDE, w/syntax highlight.
/utils/pp104swv.zip 44 ** ---P Protect .exes from hacking
=-[Articles]=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=---------------------------------------------------[Introduction]--[Snowman]-=
Hello all, and welcome to DemoNews issue 118.
First off, I'd like you all to note that we've passed 2000 subscribers this
week! I consider that a milestone. When I started helping with DemoNews
that number was under 300. My personal thanks goes to all those who have
helped contribute over the past several years, as well as those who have
supported and subscribed to this online publication. I used to ask the
question "When will we finally saturate the scene?" I now believe that we
won't. Not only are huge segments of the demo scene finally getting
online, but countless individuals are now just discovering it.
After reading almost all of "The Road Ahead" by Bill Gates, I am inspired.
Our little listserver error two weeks ago is only the first of many
creative and new ideas.
For the past couple of weeks, our site has been getting a lot of action.
The /pub/demos tree is seeing 3.5Gb a transferred a day on average (that's
about 100Gb a month)! Believe it or not, this isn't even 1/3rd what the
/pub/games archive is getting. Now, I like games just as much as the next
guy. However, games aren't really my first love. I encourage you all to
use our demo archive and download as much as possible, as often as
possible, at weird hours of the day, while eating, while in the shower,
while sleeping, while doing your homework... :) Let's see if we can hit a
5Gb day!
Don't forget to submit articles to Darkness / Imphobia for the upcoming
diskmag.
Snowman / Hornet - r3cgm@cdrom.com
=----------------------------------[Quotes Heard in the Demoscene]--[Trixter]-=
[This list was compiled by Trixter]
_____General Quotes
"Good code isn't good design, and good design doesn't need good code."
Charlatan
"Jezus Christ, are we still having this conversation?"
Luc Lodder, on the Amiga vs. PC debate.
"When the finish Head General sees the Russian army coming he just boots up
his PC and loads Second Reality. Then when all the ruskies are staring in
disbelief, a plane drops a bomb on them."
Tony, on how the Finnish demoscene could help in the Finnish army
"The number of channels available with a PC trackers has led to a
generation of lazy mod composers. Instead of using a trick, let's use
another track!"
Moby / Nooon
"Hello, people!! Monitor manuals have H-Sync V-Sync tolerance listings for
a _REASON_!!"
Lance Kalzus, on reports that Xtal by Complex was blowing up monitors
"Moral: Never underestimate democoders..."
PsychoMan, on people who think democoding is a limited art
"Personally, I'd be surprised to see someone release something on CD that
was made up of huge, total, game. Come to think of it, you could create
RPGs that take an average of 1.4yrs to complete, if you just stretched your
mind and put a GAME on the CD instead of an 'interactive movie'."
Mr. P, on the future of gaming
"The trick is to forget about writing something good and pull cheese out of
your butt."
Necros, on how to win the '20-Minutes' compo
"A DOT!!!! A FUCKING DOT!!!! YEAH!!!!!!!"
Chris Chapin, on getting his first graphic element working
"I have to figure out what 'music good moose american!' means."
Leviathan, on translating some of the european fan mail he gets
"The life of the coder is that of the hermit, except the hermit can't make
shadebobs."
Leviathan, on coding
"You're just trying to find texture coordinates, not to be mathematically
correct."
Midnight, on how accurate you should be while coding environment mapping
"People often forget God's contribution to the demo scene. He coded some
brilliant effects, all real-time as well."
Lew
"As we all know, the audience voted for best productions at Juhla Pi. And,
as always - audience was stupid."
Jmagic, on why the world's first real-time raytracing demo didn't win 1st
place at Juhla Pi
_____On Having Sex
"Coders do it with a routine."
Otto Chrons
"Coders do it with bugs."
Trixter
"Trackers do it with rhythm."
Floss
"Trackers like to slide up & down."
Charlatan
_____You Know You've Been Democoding Too Long When...
"...You think 'hey, the phong shading on this toilet seat is really cool'
and move it up and down a few times just to watch the highlights..."
Sam
"...You're in a train looking out of the window, and you notice the
high-quality multi-layer parallax scrolling."
Sam
"...You spend an hour in the tub trying to figure out displacement."
Leong
"...You walk along a wall and are impressed that it's not pixelated,
even at close range."
Dag-Erling Smrgrav
"...You notice how the faucets in bathrooms are envirovment mapped
with a nice metal-looking texture..."
Jyrki Saarinen
"...You move objects around to make sure the clipping and culling
routines are working."
Quantum Porcupine
"...You spill or mess up something and the first reaction that come
to mind is 'undo'."
Stephan
"...You watch the "Mortal Kombat" movie, and during the part where
Liu Kang does a flip off a wall, you absent-mindedly say, 'I wonder
if that was calculated real-time.'"
Dominion Arcana
Trixter / Hornet - trixter@ftp.cdrom.com
=--------------------------[10 Ways NAID '95 Will Differ from NAID '96]--[GD]-=
_____Introduction
Are you considering going to NAID this year? Not sure if you want to go or
not? Heard some things that made you suspicious?
Many people seem unsure whether or not they want to make the sacrifice of
time and money to attend. With pressures of school and final exams, some
potential attendees are unsure if they will make it to NAID 1996.
Following is a list of ten ways that NAID 1996 will differ from NAID 1995.
Hopefully, you will see that this is to be a party you won't want to miss.
_____Reason 01: From Spotlights to Lasers
The NAID organizers have been discussing the possibility of a laser light
show this year. Remember those "dance floor" style spotlights they used last
year? Well, those would be replaced by laser technology.
This will improve the visual effects greatly. By adding laser lights to the
setup, it will create an incredible effect for those who want to feel as if
they're at a real rave. Even better, anyone needing laser surgery can just
position themselves appropriately between laser beams and save thousands of
dollars in medical fees.
_____Reason 02: Parlez-vous francais?
The language barrier was one difficult aspect for some Americans traveling
to Montreal. As those who live in Montreal speak french as their primary
language, verbal communication was a problem.
With a year and two months between NAID 1995 and NAID 1996, hopefully some
people have tried to work on the issue of the language barrier. However, I
suggest a French-English dictionary, as some of your good friends who know
french are most likely going to only teach you french phrases that
translate into something like "You look like my mother, you stupid
pancake!" or "Will you go to bed with me, you revolting jackass?"
_____Reason 03: Price Difference
People have been talking about the difference in ticket prices this year. The
admission fee is CA$20, as compared to last year which cost CA$7.
The organizers have decided to combat complaints about the sudden price
increase with some special deals:
Three-Arm Discount (TAD) : All persons with three arms shall receive 50% off
the admission fees.
Two-Foot Discount (TFD) : Anyone who stands less than two feet tall will
only need to pay CA$2 for admission.
Green-Hair Discount (GHD): Anyone entering with green hair will be admitted
for CA$5. Persons taking advantage of the GHD must
pose as plants any time someone's parents walk by.
_____Reason 04: The wrath of PeriSoft
Ever since last year, PeriSoft has been plotting his revenge against the
"evil forces of Hornet" for the comment about him in the Hornet NAID report.
This year, witness it live as the drama unfolds.
Supposedly, one of PeriSoft's revenge tactics will be to bring an Alannis
Morrisette CD and secretly place speakers in the Hornet room through which
this CD will be played constantly. The results of such an experiment could
have drastic effects, so watch and see what happens.
_____Reason 05: Necros
Dungeon Dwellers Design is a USA-based demo group that was in attendance at
NAID 1995. They also entered a demo into the competition. They took many
pictures at NAID and released a party report.
Unfortunately, DDD made several errors in their NAID report, which confused
some people as to who won which compo with which entry.
This year, Necros may fall victim to a large amount of lamers asking him if
he is going to write another song like his hit, "Can't Take the Bus."
_____Reason 06: The Snowman Speech
Before the closing ceremony last year, Snowman presented a very memorable
speech to the soon-to-be-departing crowd. As many people complimented his
efforts, he will again be making a speech this year.
However, this year's speech proves to be more than a monologue, as Snowman
recently released his cast list:
Ara (formerly Epeius) ............... Human "beat box"
The Zapper .......................... Bass Guitar
Maelcum ............................. "Move it Move it" voice
Miss Saigon ......................... "Whoo! Yeah!" voice
_____Reason 07: Drugs and Alcohol
Drugs and Alcohol are prohibited in the school at which NAID 1996 will be
held. Because of this, the organizers are making special arrangements to
inspect the belongings of those suspected to have any illegal possessions.
They are arranging a "we get half, you get half" deal with anyone who
wishes to consume said possessions at the party place. Be sure to stock up
and bring twice your normal supply.
_____Reason 08: 1-900-NAID-FUN
The organizers have been so overwhelmed with telephone calls that they have
set up this 1-900 answering service. Callers will be able to get their
questions answered and even get a chance to win some great prizes! The
prize list follows:
Free NAID tickets will be given out to every 1000th caller
If you are able to "Name this Hadji S3M" you can win one of these
fabulous prizes:
- Year old subs (leftover food from Subway, who served food at NAID
1995 and forgot to clean up)
- Year old tshirts (they were left outside during a rainstorm, and
put through a very powerful dryer. All shirts are
now exactly 7 sizes smaller than stated on the
label)
Each call costs $1.00 a minute. If you're under 18, be sure to get
permission from your parent or legal guardian before calling.
_____Reason 09: The "Deep-Six Demo Compo"
Is your computer waterproof? Ever thought of putting it inside a sealed
plastic bag and submerging it in water?
Since the pool was not used much last year, the organizers have introduced
this competition, which states that "Computers will be submerged into the
pool after starting a popular European demo. The owner of last computer to
remain running underwater is the winner.
The organizers are seeking judges for this competition. To be eligible, you
need to be able to hold your breath for 10 minutes, have a certified
lifeguard license, and sign a release form stating that the organizers are
"not responsible for drowning, choking, or excess water intake."
_____Reason 10: Electricity
Last year the organizers were very fortunate to not experience any amount
of interruption in the power supply. There were no power failures and no
equipment was damaged by a spike or surge.
This year, you won't want to miss out on your chance to fry the power
system! Be the lamer responsible for a blackout during the demo
competition! Get hundreds of angry partygoers chasing after you!
To enter in this competition, all you need is an electrical device which,
when plugged in, will overload the circuit breaker and cause a power
outage. Winners will receive a first-class shunning.
_____Conclusion
This guide is your road map to fun at NAID 1996! Be sure to attend this
event because it only happens once a year.
Enjoy the show, meet new friends, and learn how to swear at your parents in
a different language! What more could you ask for?
GD / Hornet - gd@ftp.cdrom.com
=-----------------------------------------[Funktracker Port to Linux]--[JsNO]-=
I've began work on porting Funktracker from the DOS32 protected mode
platform over to X11/Xview, first for Linux, then other Unix's. As this is
mainly an exercise to learn X-windows programming, I will be taking it
easy. It may be a while before there is a releasable version.
NOW would be a good time to tell me anything that you want in there. I've
had wades of email about requested extras and changes that people wanted in
1.08b, but couldn't, due to the fact the requests were never considered in
the initial contingency of FunkTracker. So, if you tell me now in the
designing stage, it will be far easier for me to put in.
I'm going to attempt to give it the look and feel of the original
FunkTracker (in an Xwindows sort of way), so, if you don't like the
original Funky style interface, tell me now, and i'll alter it on weighted
opinion.
See ya.
JsNO / Super Real Darwin - root@superr.topend.com.au
=------------------------------[Intro to 3D Graphics - Volume 03]--[Kiwidog]-=
_____Introduction
Howdy everyone!
Time for round three... :-)
This is the last introductory article before we dive into polygon fillers,
and it's something that's crucial to any effective 3D system. You may be
asking yourself, "Hey, I can do projection and rotation now, isn't that all
I need to start making solid objects?" Well, not quite.
Let's say you want to make a cube. You know how to project the cube's
vertices, so that's fine. You can rotate the vertices too, so that's not a
problem either. And let's say you know how to do polygon filling too...
well what happens when you start rotating the cube around?
A big mess. :) Sides in the back show up half the time, so the cube
doesn't look solid at all. And then you decide you want to add
lightsourcing... uhh.... wait... lightsourcing? How do I do that again?
Yup, something's definitely missing. :-)
It turns out that backface removal, lightsourcing, and a whole mess of
other 3D-related issues often stem down to one small, yet very important
math concept...
The normal.
_____What the Heck's a "Normal"?
The normal is just the name of the vector that's perpendicular to a plane.
It's as simple as that (actually, I should be using the word "orthogonal",
since that's the real name for perpendicular in 3D, but you get the idea).
That's all it is. Every 3D plane in space has a normal; it's just the line
that sticks straight out of that plane.
So what's so useful about normals? Well, if we have a 3D surface (like a
polygon face), the normal tells us where the polygon is facing... it's the
line that the polygon is "looking at", and that has a LOT of uses.
For one, backface removal. You only want to see a polygon face (like on a
cube) when the surface is facing toward you. If it's facing away from you,
you shouldn't see it (unless you want paper-thin objects). So the normal
is very useful here.
And lightsourcing is entirely about normals. If you take the angle between
the normal of a surface and the vector of surface to the lightsource, you
can find out how much it's facing that lightsource and can use that for
brightness. We'll be using this fact a lot with Lambert, Gouraud, and
Phong shading, as well as Environment Mapping.
There are also other nice thing normals are used for, like calculating BSP
trees and such. The list goes on and on....
But I'm probably overwhelming you with all this. Let's take it one step at
a time, and all the rest of the pieces will face into place later. Don't
worry if you're confused for the moment... it'll click soon enough. :)
_____Finding the Normal of a Plane
You've already dealt with a few normals - the axes. The Z axis sticks
straight out of the XY plane, which means (tada!) that the Z axis is the
normal of the XY plane. Likewise, the X axis is the normal of the YZ
plane, and the Y axis is the normal of the ZX plane.
But what about arbitrary surfaces? Most of the time, with our 3D objects,
we won't know where they're facing. They won't be on the axes most of the
time, that much is for certain. So what do we do to find these special
vectors?
_____The Dot and Cross Products
There are two very useful operations in linear algebra called the Dot
Product, and the Cross Product. They're not really hard at all; the
equations are pretty simple. But they come in very handy, as you'll soon
see. Like the Trig identities, these are two of the most important things
you'll ever use in 3D.
The Dot Product is just a value (or "scalar", in linear algebra terms).
It's a function of two vectors, and usually denoted with a "." character.
If we have two vectors A and B,
A.B = (Ax * Bx) + (Ay * By) + (Az * Bz)
That's it. Just multiply the XYZ parts together of each vector, add them
up, and the resulting number is your dot product. What's it for? We'll
see soon enough...
Now the Cross Product is a little more complicated of an equation. Like
the Dot Product, it's a function of two vectors. But unlike the Dot
Product, the result is not a scalar value.... it's another vector. If we
have our A and B vectors, and C is the cross product (denoted A x B),
C = A x B
Cx = (Ay * Bz) - (By * Az)
Cy = (Az * Bx) - (Bz * Ax)
Cz = (Ax * By) - (Bx * Ay)
That's how we get each of the XYZ components of the cross product vector.
Well what's C after we do this? A very nice thing... it's the vector
that's ORTHOGONAL to A and B.
Yup, the Cross Product is our normal! :-)
Sure enough, if you check these equations against some normals we know,
like the axes mentioned above, it turns out that
(1,0,0) x (0,1,0) = (0,0,1) Z axis is orthogonal to the X and Y axes.
(0,1,0) x (0,0,1) = (1,0,0) X axis is orthogonal to the Y and Z axes.
(0,0,1) x (1,0,0) = (0,1,0) Take a wild guess. :-)
Now, we can't necessarily use this directly with our polygons. I mean,
with our polys all we have is a set of vertices (each 3 for a triangle, 4
for a quadrilateral, whatever). We don't have two vectors. So we need to
find two vectors in our poly that we can shove into this cross product
equation, and find our normal.
How to do that? Not too hard, really. We can form two vectors from any
three points in a poly. Say we have a quadrilateral polygon.....
P2
. P1
.
.
P3 . P4
Okay, all we need to do is get two tail-to-tail vectors from the poly.
Solution? Simple, just pick a point, and use the vectors to the two points
"connected" to it along the edges...
P2
.___ A P1
----.
\
\ B
\
.
P3 . P4
Be warned, though.... the cross product function is NOT commutative. That
is, A x B is NOT the same as B x A. As a matter of fact, B x A is the
exact OPPOSITE vector of A x B.... it's the same line, just pointing in the
other direction! :)
How to know which one to use as A and which as B? It depends on what kind
of objects you're using. If you're importing from a modeler of sorts, most
modelers either order the vertices a certain way or have some kind of field
telling you which way the normal is. Then you'll know which vector is
supposed to be first, so your normal is in the right direction.
Otherwise, if you're making your objects manually, you'll have to be a
little more innovative. Many people like to create their faces so the
vertices go in either a consistent clockwise or counter-clockwise order.
Then you start at a consistent point in the polygon (like the first
vertex), and you know which point goes with which vector.
It's really a matter of taste, but whatever you do, you should be
consistent. Manually correcting normals that go wrong is a real pain in the
rear, so getting the system down right the first time will help you a lot
in the long run.
(BTW... in the above ASCII picture, the order that A and B are in will
result in a normal that goes up, towards where the "P1" label is).
Now to get nice, accurate normals, we don't want the poly's location in
space to have any effect on it... true "vectors" aren't points, they're
rays going from the origin to a point. Well, P1 probably isn't going to be
at (0,0,0). So for the cross product we need to calculate the vertices as
if it were. This is just done by translating the points, subtracting P1
from both the P2 (for vector A) and from P4 (for vector B)...
A = (P2 - P1)
B = (P4 - P1)
Bam, now we just shove A and B into the cross product formula, and out
comes our normal. Almost.
(Don't you just LOVE these "almosts" and "not quites"? :-)
_____Size Matters
Only one more thing we have to do to the normal to get it exactly the way
we want it. We need to scale it down (or up), so that the vector has an
exact length of 1. Why 1? Because having normals of length 1 is a really
nice thing as far as calculation is concerned. It's mainly for the "angle
between" equation we need for lightsourcing. I'll get to all that in a
little bit, but for now, just trust me.... we want it one unit in length.
:)
Doing that isn't really difficult... we just use the distance formula. From
algebra you probably remember that in 2D, the distance between any two
points is
length = sqrt( (x2-x1)^2 + (y2-y1)^2 )
That gives us the distance, or length, of that line segment. The same
thing applies in 3D, by adding the Z component...
length = sqrt( (x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2 )
Well a vector has just one point... the other point is at the origin, so if
we want to find the length of our normal, we just set point 1 to (0,0,0),
and
length = sqrt( x^2 + y^2 + z^2 )
Odds are, when you pump in your normal's values you got from the cross
product, the length is NOT going to be equal to 1. It could be 0.2, it
could be 10.583, it could be three-thousand-something. Anything. Well
since all we care about is direction, not length, we can divide every XYZ
component in the normal by its length, and the new length will become 1.
As an example, say our normal was (3,5,2). The length would be
length = sqrt( 3^2 + 5^2 + 2^2 ) = (9+25+4) = 38
So if we divide each component by 38, our final, scaled normal would be
(3/38, 5/38, 2/38)
Now as you can see, if all our normals are going to be length 1, then we
need to use decimal places.... no component is ever going to be above 1 in
size. But using floating point is incredibly slow, and pure integers don't
allow for decimal places. The solution? Fixed point.
_____A Sidetrack on Fixed Point
Fixed point is an easy way to represent non-integer numbers with only
integers in the processor. It's done by taking a certain number of bits in
a register, and dedicating them to decimal places instead of integer
values. Like if we have a 16-bit word, we can do 8.8 fixed point by using
the upper 8 bits as the "whole" portion of the number, and the lower 8 bits
as the "fractional" portion.
Examples of 8.8 fixed point....
1.0 = 0100h
1.5 = 0180h
0.25 = 0040h
3.75 = 03C0h
5.125 = 0520h
...and so on. All we're doing is using the high byte as the whole, and the
low byte as the precision. How precise? Well since we have 8 bits in the
fraction, it means we can go down to 1/256 for a fractional value. The more
the fractional bits you use, the more accurate your decimal places can
be... but the fewer number of whole-number bits you have left (so your
value can't go up as high).
Sure enough, you're not limited to equal splits. With 16 bits you can do
things like 15.1 fixed point (which only goes down to 0.5 for decimal units
but allows numbers up to 32767), or you can do 1.15, which can only have a
whole number of 0 or 1, but goes down to 1/32768 of decimal accuracy. You
choose what works well for your system.
(Incidentally, since I code 32-bit mostly these days, I use 16.16 fixed
point for pretty much everything 3D-wise. It's accurate enough in decimal
places, yet has wholes up to 64k which is a nice range).
To sum up, fixed point is just treating integers as fractional numbers by
working with the numbers a few powers of 2 above what the number actually
means. In 8.8, 0100h (256) means 1, 512 means 2, 768 means 3, etc...
you're just scaling the operations up a bit so you can stick with integer
operations.
Adding and subtracting fixed point is just like regular integer add and
sub. You don't have to do anything special...
1.5 + 1.5 = 3.0 0180h + 0180h = 0300h
2.75 - 2.25 = 0.5 02C0h - 0240h = 0080h
...and so on. On the other hand, multiplication and division have to be
adjusted by the number of places in your precision, since the resulting
number would be too high for multiply, and too low for divide....
1.5 * 3.0 = 4.5 0180h * 0300h = 048000h
NOPE! We have to divide by 100h (8 bits precision).
0180h * 0300h = 048000h / 100h = 0480h (correct)
Likewise, division needs to get multiplied by your precision. This must be
done BEFORE you divide, or you'll end up losing all your decimal places.
7.5 / 2.5 = 3.0 0780h / 0280h = 0003h
WRONG! We need to multiply....
0780h * 0100h = 078000h / 0280h = 0300h (correct)
Note that this means for multiply and divide that you'll need more space
than just what's in your fixed point registers. Luckily multiply and
divide on the Intel processors multiply into and from EDX:EAX, so you've
got extra space already even if you're using assembly language. And the
adjustment mul/divs are all powers of two, so you can use bit shifts
instead (if you are using 386 regs, make sure you look up the SHLD and SHRD
instructions... they come in real useful for this...)
Okay, enough of that sidetrack. That's the basics of fixed point. It's an
excellent alternative to floating point, and it's the only way to get
really good speed with 3D on an integer unit, since you can't use fast
normals that aren't 1 unit in length.
That's all you need to know about finding normals! :-) Here's the quick
summary. To get a normal from any polygon (with any number of vertices)
1. Choose three vertices from the poly that are connected by two edges. The
middle vertex is the base of both your vectors, so translate all three
points so that this base point is at the origin.
2. The two vectors are the two other points after translation. Choose your
first and second vector in the right order so that the normal goes in
the direction you want it, "in" or "out", so to speak. If your vertex
ordering is consistent or you're importing from a modeler, this
shouldn't be a big problem.
3. Take the cross product of the two vectors, in the right order.
4. Scale the cross product down so its length is equal to 1. This is your
final normal for the poly (yay!) :)
_____You Want Me To Do All That REALTIME?!?
Heck no! :) Calculating normals for every surface every frame would be
incredibly slow. Major MAJOR waste of time. But you don't have to worry
about that, because you can precalculate your normals for the original
object, and guess what?
If you rotate the normals by the same angles that you rotate the object,
the normals will still be correct! :-)
So just generate your normals when you load up your object, or store them
in the object file itself (if you have your own file format, this can be an
easier option). As you rotate your object by rotating all the vertices,
just treat the normals like regular vertices. So when rotating a cube, for
example, you won't be rotating 8 points... you'll be rotating 14 points,
i.e. the 8 vertices and the 6 normals.
_____In Our Next Episode
There are certainly other ways to deal with normals besides straight
rotation and such, and I'll show you these methods as time goes on. We'll
also be using these normals (and the thus-far-useless Dot Product) next
time, when we start our polygon filling escapade! :) The next article will
cover how to fill polygons with a flat color, and also how to lightsource
that color using our normals, so don't throw this article away just yet...
this info will become very useful very quickly.
In the meantime, the supplement will have example source that shows how to
use normals for simple backface removal. I'll put a lot of comments in
there so you can see what the normals are doing to make it possible.
It's quite easy...
Anyway, take a look at that source (in Pascal and C, once again... BTW some
people have asked me if I'll be doing more ASM source later on, and the
answer is yes, I will be)... and play around with some of this stuff on
your own! :) I realize there's not much to gain from this article by
itself, but it'll give you time to get a very critical portion of your 3D
system going. Even if it's still wireframe, it's a big step.
_____BTW
The supplement files are being renamed from DNxxx_3D.ZIP to DN3D_x.ZIP.
This is because it seems I'm not going to make it for every single DemoNews
issue, so it's probably less confusing if I name them by volume number than
by DemoNews issue number. As such, this article's supplement will be at
ftp.cdrom.com/pub/demos/incoming/code/DN3D_3.ZIP
DN114_3D.ZIP and DN116_3D.ZIP will be renamed to DN3D_1.ZIP and DN3D_2.ZIP
within the next couple weeks, so don't be surprised if you don't find them
under their old filenames after a while. All new supplements will be in
/pub/demos/incoming/code/
and the previous ones will be under
/pub/demos/code/tutorial/
so look there if you don't find them in incoming.
Also, give me a couple days after this DemoNews's release to upload the
supplement file. I tend to write these articles a little close to the
wire, so I don't have time to get the supplement up immediately. If you
don't find it in /pub/demos/incoming/code, give it a day or two before
emailing me saying you can't find it.... it's probably just me being lazy.
:-)
Until next time...
Kiwidog / Hornet , Terraformer - kiwidog@vt.edu
=-[Subscribing]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
_____How to subscribe to DemoNews
Mail to : listserver@unseen.aztec.co.za
Body : subscribe demuan-list [first_name] [last_name]
The listserver will send DemoNews to your e-mail's return address.
_____Back Issues
Older issues of DemoNews can be located under /demos/hornet/demonews.
Newly released issues of DemoNews are posted to /demos/incoming/news.
=-[Closing]-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
For questions and comments, you can contact us at r3cgm@cdrom.com
Your mail will be forwarded to the appropriate individual.
...........................................................End.of.DemoNews.118.