Beebug


Realtime Solids Modeller

 
Published in Beebug #60

Realtime Solids Modeller (Silicon Vision)

Geoff Bains looks at the new graphics package from Silicon Vision which takes us into the exciting world of solids modelling.

When Beebug reviewed the Realtime Graphics package, both in its original form from Glentop (Vol. 4 No. 5) and in its later reincarnation from Silicon Vision (Vol. 5 No. 10), it was difficult to see much in the way of possible improvements which could be made to the functions ot the system, although some of the ergonomics of it all were far from perfect. Then I compared the graphics produced by the system with Elite, for quality and speed - wireframe spacecraft flitting about the screen, and all from a Basic program anyone could write.

That was impressive then but now Elite has moved on to the Master version with solid spacecraft. Not to be outdone, Silicon Vision has released Realtime Solids which does all that the wireframe package did (and better) but with solid models, and it still only requires a model B (although it is quite happy with a B+ or Master).

"Realtime Solids' takes all the hard work out of truly impressive graphics displays on your BBC micro. It provides all that is needed to create the mathematical models of complex solid shapes, draw them on the screen from any view with full hidden line removal, output the view to a plotter and animate complex sequences.

The whole package is dependent on a 32K ROM containing all the routines for performing the co-ordinate transformations, and for the super-fast plotting required. The software also includes six discs containing the programs to create the models and demonstrations, and example models to play with.

Creating a model is a matter of mathematics. This is the hardest part as it requires you to visualise your object in terms of 3D co-ordinates. These are entered into a kind of 'point processor' (see photo one) along with details of the the line type and colour, and whether the point is to be drawn or moved to.

That much is rather like the Realtime Graphics wireframe predecessor. However, the operation of the co-ordinate editor is much easier now with functions like point deletion and insertion available from the same screen. Also additional is the Facet command. This lets the system know that the following points make up the vertices of a flat side of the object. The colour for filling in areas can be separately defined and the face can be any shape. The order of the vertices' co-ordinates determine from which side the face is visible. A face can only be seen from the side with the vertices appearing clockwise around its edge. This is the most difficult part of all to get to grips with and causes frequent (and sometimes unavoidable) problems with the final model.

The Realtime Solids package deals with three different views of models - wireframe, convex solid and concave solid. The wireframe model is familiar to all Beeb users. A wireframe cube is illustrated in photo two. This shows all the points and lines defined with no thought of real life possibilities. In other words you can see edges that are at the back of an object.

The convex solid view takes account of the opacity of the faces. Points and lines (or parts of lines) hidden behind a foreground face are not shown, nor are faces viewed from the 'wrong' side. A cube correctly defined, with vertices going clockwise around each face when viewed from the outside, is a convex solid - it has only an outside (as far as the model is concerned). However, remove the top face from this cube and the system has problems (photo three) - it cannot see the wrong' side (the inside of the back faces).

To cope with this, we display the open cube as a 'concave' solid. Now the system can 'see' both sides of each face and it interprets the open cube correctly (photo four). The problem with this concave view of models is that it takes longer to work out and to plot, something that matters when you come to animation. The same is true of any 3D solids system. All the spacecraft and planets in Elite are convex, closed solids for this very reason.

To get the views of complex concave models right a separate 'processing' facility is included in the Realtime Solids package. This orders the faces of a model in the systems own internal way to make sure it is drawn correctly and more quickly from then on. This enables spacially complex models like the chips in photo five to be drawn correctly (well, almost correctly). Even after processing some errors can occur - the front row of pins on the upper chip have no 'tops' as the system incorrectly thinks these are completely hidden).

To make life simpler for creating complex models (and it certainly needs simplifying with all this to bear in mind), the system has some useful ways of building large complex models from small simple ones. A macro facility allows you to add one model to another having first rotated, translated or scaled it. In this way simple cube and pyramid building blocks become almost all you need.

Curved shapes and prisms can be created from even simpler primitives. The three sides-of-a-square in photo six can be rotated about the y-axis to form a disc (photo seven) with all the calculations and all the work done by the software. As well as the wireframe profiles of the old system, the Realtime Solids package can produce solids in this way. Translate the primitive along the x-axis before rotation and you get an open centred torus (photo eight). Performing other transformations first gives you other final shapes. Another useful addition to the system is the 'extrusion' facility which creates a complex shape from a primitive by repeating it along an axis (photo nine). It's rather like squeezing icing through a primitive-shaped nozzle!

It doesn't take much imagination or effort to create extremely complex shapes from very simple beginnings. When you've mastered the ins and outs of your model, entered the primitives' co-ordinates and rotated and extruded them into the final object, you can save the model on disc and inspect all your handywork on the screen, viewed from any angle (it is this viewing mode which is shown in the photos). Different screen modes can be used too, but the model B is limited to mode 4 and mode 5 (for colour). A Master or second processor is needed for modes 0-2.

These views can then be saved to disc as screen RAM dumps or as sequences of VDU codes. The VDU code files can be used to redraw the image on a machine without the Realtime Solids ROM or for feeding to a plotter.

This generalised 3D drawing and hidden line removing aspect of the Realtime Solids package is a feat in itself. However, the real strength (and the 'realtime' nature) of this software, like the Realtime Graphics System before it, lies in the Realtime Graphics Language (RGL) which forms the heart of the ROM.

The ROM contains all the routines for fast effective animation programming requiring only Basic programming skills from the user. The new RGL closely follows its predecessor. It has been extended to encompass solids and allows several types of display - wireframe (as before), convex solid without face colour, convex solid with face colour and concave solid.

Models are plotted on the screen by setting up the viewpoint with various Basic variables (xrot%, ytrn%, zscl% and so on) and calling the transformation and plotting routines in the RGL ROM. Speed is all important for animation of complex models such as these and the RGL is indeed fast. Although models such as the chalice take time to draw and so cannot be usefully animated, relatively simple objects such as Elite-type spacecraft can be realistically moved around the screen. A two-screen changeover process (all automated by the RGL) speeds the process considerably and removes all traces of flicker. More than one model moving at a time is quite possible as well, although too much overcrowding inevitably reduces the overall speed.

The new Realtime Solids system allows model data to be 'optimised' - sorted to remove repeated plots to any vertices - and a new 'turbo' command plots such optimised data even faster than the original software. Both new and old data formats, and new and old commands are in the new RGL for compatibility with old data and programs, but for new work the turbo option is well worth using.

Using the RGL is not easy. A whole host of variables have to be declared and zeroed, the right mode used for the size of model data table and for the machine, you must keep track of the memory usage the whole time and remember a whole host of commands. However, 23 example programs are given on disc and the easiest way to get to know the system is to mess around with these and adapt them to your own purposes. Indeed these programs will probably form the basis of all your future efforts.

The learning process is not helped much by the manuals. The original manual supplied with the Realtime Graphics system is reprinted with the new software (it's reduced in size to A5 size but is otherwise identical). The new aspects of the software and the new RGL commands added to extend the software to solids and hidden line removal are all covered in a separate manual. As the original manual was never too good in the first place, simply adding on like this is not a good idea, even though the extensions manual is much better written and produced. It is hard work to get to know the system.

However, getting to know the Realtime Solids package is certainly worth the effort. It is doubtful that any other software outside of games like Elite push the BBC micro to the same extremes of its capabilities. When you see a smoothly animated display of a solid object with full hidden line removal and hardly a trace of flicker, it is hard to believe that only a Beeb and a simple Basic program is behind it all.

Vital Statistics

Product: Realtime Solids Modeller
Supplier: Silicon Vision, 47 Dudley Gardens, Harrow HA2 0DQ. Tel: 01-422 2274
Price: £89.95 (£39.95 Realtime Graphics upgrade)

Geoff Bains