This kind of software allowed the definition of shapes in three mathematical dimensions. Then these objects would appear from an angle. It's a far cry from today's modellers, where it is possible to sculpt an object directly on the screen as it appears. Also, these little programs are not really Computer Aided Design packages by any means, but it's still interesting that these were ever made.
VU-3D on the Spectrum
VU-3D was created in 1982, released pretty much alongside the release of the Spectrum. Psion made some of the most competently programmed software of the early Spectrum days. To my knowledge, since then nobody has really attempted to create a three-dimensional object modeller and solid renderer on the Spectrum. 3D Construction Kit (1991) from Domark might be closest to the description.
The VU wineglass, the Spectrum equivalent of the tea kettle! |
At least to me, the VU-3D wine glass and box image was one of the early "iconic" images associated with the Spectrum. The screenshot was the basis for the cassette inlay of the package.
The three-dimensional shape is created by adding sections from bottom to top. |
The editing is quite slick, but does not have any functions for modifying the existing points (that I know of). Nor is there any grid snap that would have made it easier to align the points. When viewing the object, there seemed to be some limitations to the angles from which it can be viewed. So, when devising the object, one needs to be careful to think which way it will be positioned, as this fundamental angle cannot be changed afterwards.
Viewing the created object. |
ORIC CAD
Curiously, a very similar program exists for the Oric home computer, produced by Tansoft. After about 10 minutes of loading (in the slow speed) the user is greeted with a screen of text. Everything appears to have been written in BASIC. The demo object is a kind of round object made from an extruded pentagon, not as impressive as the wine glass on VU-3d.
A complete 8-bit CAD workstation! |
The shape addition is not that different to the VU-3D. However, it is possible to go through existing points in the shape and adjust their coordinates. This makes it much more simple to correct any distortions that might have occurred.
Outlining the shape plan with ORIC-CAD. |
One question is whether the Oric program is just a straight copy of the VU-3D, or whether there exists a common precedent that they both attempted to emulate. Perhaps there is some precedent on the bigger computers or turnkey CAD systems. Possibly it was something that was featured on a TV show, so the programmers might not even have had real first-hand experience of these bigger programs. But then again, Psion programmers for the early Sinclair software appear to have been quite competent so who knows.
3-D objects in Sinclair BASIC
Given the simplicity of the above programs, it might be just as useful (or useless) to write a program of your own. So, of course I could not resist the idea of doing something very quickly.
The example below gives some idea how such a program could be started, although it has many limitations compared to the above software packages. Back in the day, 3-D programming was quite a difficult topic. Then I could not really work my head around it at all, as oftentimes the examples were quite impenetrable. Yet, after getting how the objects are defined as coordinate lists, it really comes down to two things: perspective foreshortening and transformation (rotation), which are applied to all the coordinates.
I only cover the foreshortening in the following, although one could argue the rotation would be just as important. The foreshortening is simply a matter of proportioning X and Y coordinates of a point with its depth coordinate. (In principle, X=X/Z and Y=Y/Z for each defined point.) Of course the depth coordinate needs to be proportioned to something that gives a working result on screen.
The proportioning is done within lines 210-232 in the listing below. In line 200, the next point coordinate set (X=-50,Y=-50,Z=-50) is grabbed from the data list, and the following lines will mangle the numbers.
210 LET D=(Z+400)/300
First, the "eye" is set back 400 units so that the object coordinates will all be positive. (This adjustment might have been done in the coordinate list, but it's clearer to define the object along it's own coordinate centre.)
The Z coordinate is divided with 300. Here it is a rather arbitrary number. It is meant to give a ratio that shows the object in good size on the TV screen. There's no "right" number as it depends also on the distance and the size of the object, and ultimately what the program is meant to do. Here I'm just interested in getting a sizeable object on screen and 300 seemed to do the trick.
Then the X and Y coordinates (horizontal and vertical) are divided with the proportioned Z coordinate, stored in the D variable. (Line 220) The line 232 moves the coordinates in relation to the middle of the screen. (Remember, Spectrum has 256*192 pixel screen)
Here's the code. Go on, type it on your Spectrum!
|
By the way, if the eye needs to be moved to the side, a LET X=X+75 (or whatever) after line 200 will do the trick. If this number is too great, the object is drawn out of screen and the program will fail.
There's some added trickery that makes the program use the previously calculated point as a basis for drawing a continuos line through the coordinates. Hence, the DRAW x2-x,y2-y thing at line 40. This helps me avoid making a separate coordinate and point connection list.
The limits of the presented program are obvious. As it is not possible to rotate the coordinates in relation to the eye, the program output is confined to frontal views. Well, one could insert coordinates for a pre-rotated, diagonal cube, but it would be more effective to have the transformation within the program. This would be done after the line 200.
Some "fun" with the above program. |
However, as Spectrum BASIC does not allow lines to cross the screen boundaries, there's only so little that can be done with the above example. Furthermore, if I wanted to extend this program for viewing objects and spaces from the inside, the lines would need to be "clipped" also in relation to the picture depth plane, which is an added complication. Including all required line clipping and transformation routines woud also slow the drawing speed.
No comments:
Post a Comment