This one time at band camp back in the mid 70′s, someone had a copy of National Lampoon‘s 3D issue. It was one of the most wonderful things I’d seen. I assume that the magazine’s owner didn’t think his parents would approve of it, so he gave it to me. I must not have seen very many anaglyphs before this because they made a big impression on me. I’m sure the naked women interested me a lot too, but I was hooked on 3D images.
Using blue and red pencils I learned to draw things that looked like they stuck out of the page and things that looked like they were behind the plane of the paper. I remember spending hours drawing with the red/blue glasses on so that when I took them off persistence of vision would make the eye with the red lens see things as blue and the blue eye see things as red for many minutes afterwards.
I found books with old style stereoscope images. I taught myself to view cross-eyed view and parallel view stereograms. I drew some of those as well. Mostly my drawings were simple geometric shapes since those are by far the easiest to draw.
Years went by and although I still found 3D images fascinating I didn’t do much with them. Then in 1985 the Amiga came out. It had much better graphics abilities than any other computer I’d used up to that point. While I’d played with 3D graphics back on my original Commodore PET it didn’t have color graphics so I had only been able to do side by side stereograms. Also, doing much in the way of animations was difficult on the PET because of it’s low resolution and tiny memory.
Back in high school I figured out how to make simple perspective calculations without using trigonometry or anything else that the microprocessors of the 1970s and 1980s didn’t have built in. Even though the Amiga had a 68000 instead of a 6502 *, it was still very limited when it came to doing math quickly. Luckily geometry gives us the concept of similar triangles. If you don’t remember about this from high school and you’d rather not try to figure out the Wikipedia page, all it says is that if you have two triangles with the same angles than the ratio of the lengths of the sides will be the same.
In the picture above the weird thing on the far left is supposed to be an eye. The blue vertical line is the computer monitor, the big robot on the right is the thing you are trying to render on the monitor and the little robot in the middle is the image of the robot with perspective applied. The thin horizontal line that hits the eye is perpendicular to the screen and where it hits the eye is our origin; at the origin X, Y and Z are all zero.
Z is the distance from the eye to the big robot.
Z’ is the distance from the eye to the screen.
Y is the height of the robot above the origin.
Y’ is the height of the robot we are going to draw on the screen. It’s the value we are trying to figure out.
The program I wrote using this was an adaptation of the game breakout or brick out. Instead of having multiple layers of bricks I covered four of the interior walls of a cube with tiles. The floor had another tile which acted as your paddle. The “front” of the cube was the plane of the monitor screen and was the other side of the cube with no tiles. A ball would bounce around inside the cube. Each time it hit a tile the tile would disappear and you would get another point. Your job was to get rid of all the cubes.
Here is a reference to it (page 97.) As several reviewers noted the game was too easy and didn’t get any harder as you went along. In that respect it was not a very good game. On the other hand it was my first major C program. Up until that point the largest C program I had written had been just a few lines for experimentation purposes. In addition to the poor game design, the code was far less efficient than it could have been. I no longer have the source for it, so I can’t be very specific, but I think I duplicated a lot of code that should have been functions.
On the other hand I did do a lot of things right. I used fixed point math; floating point is very slow on integer microprocessors. If you look at the equation above you can see that Z’/Z requires a division. This is also a really slow operation on simple microprocessors. Since I was working with a grid, the same value Z’/Z was used repeatedly I calculated that first to cut down on the number of divisions. I rewrote all of the slow parts in assembly language. I used an 8-bit color map that allowed me to have 16 grey levels for each the left and the right eye and treat the single frame buffer as though it were two separate frame buffers.
It was a fun project and I got a lot of feedback from people all over the world. This was in the days before widespread e-mail, so I got actual letters in the mail. Since I released this as shareware most of the envelopes had money in them. The whole project was great, but the best part was knowing that a lot of people had enjoyed it.