Session end : 11h59m54s | Hide picture Sexe : OFF | ![]() | ![]() | ![]() | ![]() | Donations 2024 : 679.48 € |
If you want to stay in business in the demo scene you always had to come up with new effects, cool graphics and great demos. So I often spent a great deal of time to come up with new ideas or to think about how I could convert an idea from some other computer (mostly Amiga or PC) to the CPC.
Texture Mapping was THE big thing on 16 and 32 Bit computers in the early nineties. Games like "Wolfenstein 3D" and "Doom" were selling in the millions, mostly because of the texture mapped 3D environment that was the main feature of these games (and is an necessity for any game whatsoever nowadays...). For the 8 bit users the question whether texture mapping was possible on their machines or not was the paramount concern at that time.
On the C64 and later on the ZX Spectrum some users actually managed to create 3D engines with not too many drawbacks and a decent speed. Despite the higher CPU speed (3.75 Mhz) and the better calculation abilities the CPC was somehow left out of that 3D movement. Just a few users developed vector graphics routines and besides Face Hugger and me (as far as I know) nobody tried to write routines that rotated or twisted bitmaps and not only line graphics.
When I started to work on a texture mapping routine for the CPC I didn't really know how this was achieved on other systems. I hadn't looked up the algorithms in a book or so. I just thought about how I would do that. It turned out that the ideas I had weren't this much different from how it is really done. But I figured that rotating a surface in all three axes at the same time would consume too much calculation time for an at least somewhat smooth animation.
I wanted to give it a try anyways. I thought that if I just rotated a small square and then zoomed it to occupy a more substantial part of the screen it would look a lot better, probably a bit blocky, but hey, the CPC just ran with 3.75 Mhz, any texture mapping whatsoever on this machine would have been an accomplishment worth an award for outstanding achievements!
Nevertheless I wanted to start by rotating a face around the y-axis. Doing a rotation around the x-Axis would have been easier, but I felt that it wouldn't look very impressive. Actually I intended to do both, the rotation around x or around y (but not at the same time), but just the y-Axis rotation took up so much memory that there wasn't enough memory left for the x-Axis rotation anymore.
After trying to do this rotation routine with a regular program that used precalculated slopes for the different rotation phases I switched to a direct addressing scheme, since the former was way to slow. In the direct addressing approach each individual rotation is a complete program without any loops. Instead which byte or which part of the byte will be painted on what screen position is directly coded in assembler to speed up the drawing process. But as I said before, this takes up a lot of memory so I could just created a few animation phases and then there wasn't enough main memory left for much else. So the texture mapping is the main and only feature of the demo...
When I wrote the texture mapping demo I hadn't planned a release date or place yet. I just wrote it and when I was asked to contribute a part to the Jubilee Joy demo for the 10th birthday of the CPC I accepted. Thus the Texture Mapping became the final part of the Jubilee Joy demo.
The texture mapping demo was a classic suspense part, that is it didn't reveal its true face at once but offered just enough of the effect to arise curiosity in the viewers. Bit by bit it would add to the effect until it finally revealed itself for what it was: the first texture mapping on the CPC! So at fist you saw just a regular vector line cube, then it turned to a filled vector cube and finally the textures were displayed on the four available surfaces of the cube (the top and bottom surface were never seen...). Unfortunately I think I kept the users a little too much on the tenderhook, because it really took several minutes until you got to see the texture mapping and maybe some CPC freaks just didn't have the patience.
Well, but besides that I added some extra feature that fortunately didn't take up too much memory: a light source. This light source as just a simple ball that was able to rotate around the cube in both directions on the y-axis. By calculating a vector from the sun to the cube I was able to determine the amount of light falling on the surface and thus set the luminance of the colors for the surface. Since the CPC can just display 16 out of 27 colors at a time the luminance values for each color were pre-defined in table. I tried to find the best matches for each color, but with 27 colors you can just do so much...
On a green screen it looked a lot better, since there the hues of the 27 colors compose a linear gradient from very bright to black. Even though not many people used a green screen I still created a version of the demo that was designed for green screens. It looked a lot better, but I don't think a lot of CPC users have seen it.
Later during the demo you were able to gain control over the rotation of the cube and the light source. With the correspondent keys you could move the light source in one or the other direction, turn it on or off and start and stop the rotation of the cube. I've designed the demo in a way that the cube would rotate only in one direction. I don't remember why I did that. I think a lot of extra programming effort was involved in having the cube rotate clockwise as well - or probably I was just a little lazy. I don't remember, really!
Some time later I created an update of the texture mapping that had used the extended color range of the CPC+, some new graphics for the textures and that didn't take this long to get down to business. See the Texture Mapping Plus page in the demos section for more information.