13
58 Raster Graphics at the University of Manchester W T Hewitt, R J Hubbold. A C Arnold' 1. Introduction The Computer Graphics Unit (CCU) was established in 1974 to provide a central interactive computer graphics service to members of the University of Manches- ter. In 1978 the Science and Engineering Research Council (SERC) enabled a significant expansion of the Unit by pro- viding funds for additional equipment and another member of staff. The CCU now offers its facilities not only to University members but also to SERC supported projects within the area. In 1979 the University purchased a Cenisco CCT3OOO colour raster display, and the purpose of this paper is to describe how it was integrated into the service pro- vided by the Unit. 2. Hardware Configuration and Graphics Software Structure Figure 1 shows the hardware configuration, more details are given in [ 11. The Vector General is a series 3 3D31 model with a variety of input tools and 3D transformation hardware. It is a high-performance refresh display with a parallel interface to the PDPll/45. The Benson 5342 is a fast pen plot- ting device combining the features of both drum and flat-bed plotters. The device has a large drum to which sheets of paper (up to AO). draughting film or thin card can be attached. The writing implements, liquid ink or rolling ball pens, produce high-quality output. The Cenisco is described in section 4. The device marked SE1002 is a 100 dots/inch electrostatic plotter. Until w Computer Graphic8 Unit Univeraity of Yanchater Computer Building Oxford Road Yanche8ter Y 13 OPL United Kingdom recently the only method of using this device has been a plot file post-processor which converted a line diagram into a raster picture. A synchronous link is provided between the Unit and the University of Manchester Regional Computer Centre (UMRCC) [2], and there is an asynchro- nous link to the SERC network. Both links support file transfer, and the SERC link has a virtual terminal facility. The processor is a PDP 11/45 with 124KW of memory running the DEC RSXl 1-M (V3.1) operating system. Back- ing store consists of a variety of discs and tapes. Figure 2 shows how a user program accesses the graphics devices. CINO-M [l] is a library of FORTRAN callable sub- GENISCO SERC NETWORK \ UMRCC ICL 1906A/CDC 7600 Fig. 1

Raster Graphics at the University of Manchester

Embed Size (px)

Citation preview

Page 1: Raster Graphics at the University of Manchester

58

Raster Graphics a t the University of Manchester

W T Hewitt, R J Hubbold. A C Arnold'

1. Introduction The Computer Graphics Unit (CCU) was established in 1974 to provide a central interactive computer graphics service to members of the University of Manches- ter. In 1978 the Science and Engineering Research Council (SERC) enabled a significant expansion of the Unit by pro- viding funds for additional equipment and another member of staff. The CCU now offers its facilities not only to University members but also to SERC supported projects within the area. In 1979 the University purchased a Cenisco CCT3OOO colour raster display, and the purpose of this paper is to describe how it was integrated into the service pro- vided by the Unit.

2. Hardware Configuration and Graphics Software Structure Figure 1 shows the hardware configuration, more details are given in [ 11. The Vector General is a series 3 3D31 model with a variety of input tools and 3D transformation hardware. I t is a high-performance refresh display with a parallel interface to the PDPll/45.

The Benson 5342 is a fast pen plot- ting device combining the features of both drum and flat-bed plotters. The device has a large drum to which sheets of paper (up to AO). draughting film or thin card can be attached. The writing implements, liquid ink or rolling ball pens, produce high-quality output.

The Cenisco is described in section 4.

The device marked SE1002 is a 100 dots/inch electrostatic plotter. Until

w Computer Graphic8 Unit

Univeraity of Yanchater Computer Building Oxford Road Yanche8ter Y 13 OPL United Kingdom

recently the only method of using this device has been a plot file post-processor which converted a line diagram into a raster picture.

A synchronous link is provided between the Unit and the University of Manchester Regional Computer Centre (UMRCC) [2], and there is an asynchro- nous link to the SERC network. Both links support file transfer, and the SERC link has a virtual terminal facility.

The processor is a PDP 11/45 with 124KW of memory running the DEC RSXl 1-M (V3.1) operating system. Back- ing store consists of a variety of discs and tapes.

Figure 2 shows how a user program accesses the graphics devices. CINO-M [ l ] is a library of FORTRAN callable sub-

GENISCO SERC NETWORK

\

UMRCC ICL 1906A/CDC 7600

Fig. 1

Page 2: Raster Graphics at the University of Manchester

W. T. Hewitt, et al. f Raster Gmphics at Manchester

I

PLOT0 9 PQACP ,, I '

PLDRV P L O r n

DISC

59

1 74014 T4010

I

1 74014 T4010

1 USER H GINO-M PRCaGRAM I

[ PROCESSOR I GRAPHICS SOFIWARE STRUCTURE

F&. 2

routines written in Macro-11. I t was translated from GINO-F [3] to improve speed and reduce core requirements. The library contains device nomination routines which route device-independent information to the selected back end (code generator) for device-dependent processing. Access to the Genisco, Tek- tronix. and Vector General is direct; out- put for the plotter is spooled to disc, enabling post-processors to be used to enhance the facilities available.

There are two other devices which can be addressed a t the Unit. The I11 FR80 (a film recorder) is located a t the SERC Rutherford Appleton Laboratory and is accessed via magnetic tapes which are posted to the laboratory for process- ing. The turn around is usually limited by the speed of the Royal Mail! To a user the FR80 is just another graphics device, the necessary accounting information being appended to the magnetic tape via the system software (FRACP). A Benson 341 COM a t UMRCC is also available. Plot

43-6 PLTMM

MAGNETIC TAPE

files created by GINO-M can be written to magnetic tape for processing on this COM. Submission of the tape for process- ing, however, only requires a short walk along the corridor! Both devices are sup- ported. because the FR80 has cameras which take colour film (35mm and 16mm) while the on-campus facility does not. One of the plot file post-processors enables plotfiles to be spooled to tape for FR80 processing.

3. Cenisco Colour Raster Display The Genisco CCT3000 colour raster display has a pixel memory of 640x512~8 bits. Figure 3 is a schema- tics of the device structure. The eight bits per pixel are used as an index into a 12 bit wide video (colour) lookup table (VLT) with 4 bits of intensity for each of red, green, and blue. Thus, a user can view 256 colours at any one time from a palette of 4096. The Cenisco has an integral bit-slice microprocessor which communicates with the host machine via

Page 3: Raster Graphics at the University of Manchester

60 W. T. Hewitt, et d. 1 Raster Graphics or Manchester

(640 x 512 x 8)

Fig. 3

a DMA interface. It interprets and exe- cutes commands dispatched from the host and controls the input tools (key- board and tablet). Included in its reper- toire are commands for reading/writing data to the pixel memory and loading the VLT. One of the options purchased was the vector/character generator board so that the device could be driven a t high speed as a line drawing display.

The microprocessor also holds two bit masks: the WRITE enable and the DISPLAY enable masks. The former con- trols which bits of the user data are writ- ten to the pixel memory; only planes selected by this mask are affected when data is written to the pixel memory. The DISPLAY enable mask determines which planes are to contribute to the VLT index. Index bits corresponding to dis- abled planes are forced to zero. Thus certain planes can be turned off i.e. not displayed. These features are useful for double buffering modifications to the picture. Section 4 has an example of this.

4. New Primitives for G I N 0 To make use of the Cenisco as a raster device required five new backend entry points to GINO-M:

1.

2.

3.

4.

5.

SETVLT modifies VLT entries. PUTROW writes a row of pixels to the Genisco memory. GETROW reads a row of pixels from the Genisco memory. ENAWRT specifies bit planes to accept data. ENADIS specifies bit planes which contribute to the VLT index.

SETVLT Access to this entry point is via a subrou- tine of the same name: INTEGER RED(NUMBER). GREEN(NUMBER). BLUE(NUMBER) CALL SETVLT(INDEX, RED, GREEN, BLUE, NUMBER) This overwrites entries INDEX to INDEX+NUMBER-1 of the VLT with the con- tents of the arrays RED, GREEN, BLUE, which contain appropriate intensity values. These arrays are not checked for any particular range by the GINO-M front end, though a back end may enforce res- trictions on the values. The Cenisco, for example, only uses the bottom 4 bits of each array entry to give an intensity of 0..15. When the device is initialised a default VLT (the GIN0 colour set) is

Page 4: Raster Graphics at the University of Manchester

61 W. T. Hewitt, et d 1 Raster Gmphics at Manchester

loaded and SETVLT may be invoked a t any time to change the colours on the screen.

The pixel memory which accesses the VLT to draw the image on the moni- tor may be modified using PUTROW (described in the next section). Alterna- tively, using the character/vector gen- erator, geometric primitives are added to the memory. To select a suitable colour (index) for lines/text a standard CINO procedure PENSEL(COL0UR-INDEX, dummy, dummy) is employed. Subsequent character and vector generator calls write this value into the pixel memory. COLOUR-INDEX zero selects the background colour and provides a mechanism for "deleting" lines etc.

A drawback with SETVLT is that red, green and blue are not particularly easy for a user to obtain arbitrary colours. A more user-friendly model for many pur- poses is one using hue saturation and intensity, HSI 141. Access to this model is provided by a subroutine called HSICLT. This has similar parameters to SETVLT, except the arrays represent HUE, SATURATION and INTENSITY. Furthermore they are arrays of real numbers in the range O . . l , and are therefore device- independent.

To aid selection of colour a utility program, HSI. (a CINO program using HSICLT!) is provided which displays sec- tions of the HSI cylinder and VLT on the screen. Its user can assign colours to particular VLT entries, and write out to, or read back from, disc a file containing the HSI values corresponding to each VLT entry. A further option enables the user to interpolate the colours which is par- ticularly useful for some shading appli- cations. Another subroutine, RDSHI. reads the HSI values stored by the HSI program and loads them into the VLT. Thus, the palette for a particular pro- gram can be constructed with HSI and that program can read the stored values and load them into the VLT in a single subroutine call.

Figure 4 shows a sample picture of

the screen. Only half of the VLT is displayed. the other half being needed to display the model. A menu command allows the operator to swop to the other half of the VLT a t any time.

PUTROW/CETROW Three methods for direct reading/writing of the pixel memory were considered: 1. CETPIX/PUTPIX(P) write a single

2. GETROW/PUTROW(P.N) write N pixels

3. GETARR/PUTARR(P,Is,Id,Js.Je,Jd)

pixel;

from array P;

write pixels (P( ii. j j ) . jj= Js , Je) .ii=Is,Ie) from P(Id.Jd).

The CGU offers only the middle option. PUTPIX w a s considered too inefficient and PUTARR requires too many parameters. PUTROW is a reasonable compromise; most scan-line algorithms generate data suitable from PUTROW and programming the other options is not a problem. The row is written (read) horizontally (Y fixed) from left to right (X increasing). The s tar t pixel is specified by the current point. After execution the current point is updated to the pixel below the s tar t pixel; several PUTROWs have the effect of building up a block on the screen. Only the s ta r t point is affected by the current CINO transformation. This was the only clear solution to transforming the pixel row; the GIN0 transformation in 3D includes perspective as well as shifts, scale and rotation. Scan-line algorithms normally perform transformations before generating pixel data and the pix- els are written to the display memory without further transformations. Pixels outside the current clipping limits (or device limits) are discarded. Similarly, during reading from the pixel memory (GETROW) pixels which lie outside the current clipping rectangle return the value zero.

ENADIS/ENAWRT These entry points are also accessed by procedures of the same name. When try- ing to draw "rubber band" objects, i.e. objects that are continuously redrawn as

Page 5: Raster Graphics at the University of Manchester

62 W. T. Hewitt, et al. 1 Raster Graphics at Manchester

a cursor is moved, double buffering is essential if distracting flicker and other disturbances to the picture are to be avoided. With double buffering the previ- ous frame can be erased (for example re-drawn in the background colour) and the next frame drawn in the correct colour in a plane which is turned off, whilst the current frame is displayed. Further ‘without the capability of select- ing which planes the data is written to, sweeping a line could obliterate the base picture. For example suppose a base pic- ture is in planes 0. .5 , and some new por- tion is to be added. Planes 6 and 7 will be used t o create the object of suitable size; the following code would suffice:

PREST= 1 + 2 + 4 + 8 + 1 8 + 3 2 P I = 2*% P 2 = 2”7 P T t P l + P 2 P = P I CALL ENAWRT(PT)

CALL PlCCLE CALL SETVLT(P l , I 5 . 1 5 . I 5 . 1 ) CALL SFRILT(PL.I5.15.15.1)

planer 0 3 plane 6 plane 7

enable both for writing clears only 6 and 7 plane 6 is white ao is plane 7

1 0 0 CALL ENAWRT(P) write to 6 (or 7) dmplay 7 (or 8)

data

CALL ENADlS(PT - P) CALL GET-INPUT-DATA read curaor/other

CALL PlCCLE

CALL PENSEL(P.D.ID) r l e c t correct

C A U DRAW-OBJECT P S P T - P flip plane COT0 1 0 0 until some condition satisfied CAU. ENAWRT(PT) CALL PlCClE CAU. ENADIS( PREST) display picture

clear 6 (7) while 7 (6) displayed

penrl

write to 6 and 7 clear 6 and 7

again

PICCLE is a standard GINO subroutine to clear the screen, its interpretation for raster displays has been extended, i.e. clear WRITE enabled planes. This double buffering technique is quite simple to use and produces effective dynamic pictures without too great an overhead. For displays without this mask feature, ENAWRT/ENADIS could be implemented in

software by modifying the selected VLT index (ENAWRT), and modifying the relevant VLT contents (ENADIS).

5 . Polygon Fill and Hatch A common operation on raster devices is to fill a polygon of arbitrary shape and number of vertices. This capability has been added to the graphics library via a scan-line algorithm based on the Y-X algorithm described by Newman and Sproull [S]. This method builds lists of edges that start on particular scan lines. A s the algorithm proceeds new edges are added to an active edge list. This active edge list is a sorted list of edges that intersect the current scan line. The list is updated after each scan line has been drawn. The implementation in FORTRAN required a heap for dynamic storage of the edge data. Reserving large arrays is unacceptable given the address space limitation of the PDP 11/45 (32KW per task). Some FORTRAN utility routines were provided to enable the algorithm to reduce its storage requirements. These heap or freestorage routines have also proved very useful for other features of the Unit’s work, for example menu and message software.

While implementing this routine it became clear that the routine could be extended in two ways without significant overhead. First, the spacing and orienta- tion of the scan lines could be specified. While creating an edge list it was neces- sary to transform the coordinates of the polygon vertices with the current GINO transformation matrix (includes scaling, shifting, rotating and perspective). By combining this with a scaling (the inverse of the spacing) and rotation (minus the requested orientation) the data is transferred to a coordinate sys- tem where the scan lines are horizontal and the spacing is unity. The normal fill routine is then invoked to generate the scan lines which are transformed back to the correct orientation and scale before plotting. The scan lines are plotted with MOVT02 and LJNTOZ, not PUTROW, and are therefore clipped normally. Thus, no polygon clipper is needed, the scan lines a re clipped after generation. Second,

Page 6: Raster Graphics at the University of Manchester
Page 7: Raster Graphics at the University of Manchester

64 W. T. Hewitt, et al. /Raster Graphics at Munchester

Fig. 4

Fig. 6

Page 8: Raster Graphics at the University of Manchester

W. T. Hewitt, et d. 1 Raster Graphics at Manchester 65

Fig. 7

Fig. 9

Page 9: Raster Graphics at the University of Manchester
Page 10: Raster Graphics at the University of Manchester

W. T. Hewitt, et al. Raster Gmphics at Manchester 67

the algorithm is device independent; out- put is generated correctly for any of the devices available a t the CGU, though a large number of lines could be produced for filling on the plotter. CINO enquiry functions provide the necessary device- dependent parameters.

Four subroutines are available to the user: FILL;?, FILL3, HATCH2 and HATCH3. FILL2 and FILL3 have as param- eters arrays of coordinates of the ver- tices of the closed (possibly self- intersecting) polygon in 2 or 3 dimen- sions respectively, and generate horizon- tal scan lines to device resolution. The polygon presented to the 3D version need not be planar. It is the polygon obtained after the CINO transformation and pro- jection onto the X-Y plane that is used. Two extra parameters are required for HATCH2/3: the spacing in current units and the orientation of the scan lines. Both these quantities are applied AFTER any CINO transformations. For HATCH3 it is the polygon that projects onto the Z=O plane that is filled. Figure 4 contains areas that were filled with FILL2 and figure 5 shows a sample of HATCH2 from the plotter.

Fig. 5

6. SURF and the Painter's Algorithm So far only additions to the graphics library have been discussed. How are these tools being used? One utility pro- gram, HSI. has already been mentioned; it uses FILL2 and HSICLT. Another utility program is SURF. SURF complements facilities available on the Vector General display for drawing carpet plots of sur- faces and rotating them in real time. Although SURF cannot modify the pic- ture as quickly as the Vector General program it produces a realistic picture with hidden parts removed, as seen in figure 6.

The input data is a matrix of spot heights. Each set of four data points is used to generate a facet. This facet is drawn using FILL3. Its colour is com- puted by generating an (approximate) surface normal. The dot product of this vector with the viewpoint vector (the light source is coincident with the viewpoint) gives an intensity of light reflected from the surface. This value is mapped on to a VLT entry and this is used to fill the facet. If the intensity is less than zero, the facet cannot be seen by the viewer and is not drawn. HSI is used to generate the VLT for this pro- gram, making use of the interpolate function. The hidden surface aspects of this program are handled using the painter's algorithm. The facets furthest away are drawn first, and those closer to the viewer later, overwriting any facet they would obliterate. To do this the program needs only to know in which quadrant the view point resides. Scan- ning the matrix is then straightforward. The other important feature of this pro- gram is that CINO does all the transfor- mations. The image in figure 6 took 97 seconds to draw. I t was a matrix of 40x40 data points representing magnetic anomalies on the earth's surface.

Because the shaded picture takes some time to produce a convenient method for selecting a viewpoint is needed. This is performed by manipulat- ing the orientation of the stick figure a t the right hand side of the screen. The stick figure shows the surface's coordi-

Page 11: Raster Graphics at the University of Manchester

68 W. T. Hewitt, e t d. 1 Rester Graphics at Munchester

nate axes and is drawn using the double-buffering technique described earlier. I t can be manipulated dynami- cally by pointing a t the lower displayed menu with the graphics cursor. The upper menu controls the redrawing of the main figure.

This representation is not suitable for discreet valued functions. More appropriate for these is the histogram in figure 7 . In this, each data point is used

to generate a rectangular parallelapiped perpendicular to the base of the matrix. This data represents the X-Y distribution of the centre of gravity of foetal skulls.

Selecting the PLOT menu option causes the program to read back the Genisco pixel store (GETROW). A dither- ing technique [6] is used to convert the colour and intensity values to a mon- chrome picture such as figure 8, pro-' duced on the electrostatic plotter.

FY. 8

Page 12: Raster Graphics at the University of Manchester

W. T. Hewitt, et d. J Raster Graphics at Manchester 69

7. Spheres Some projects being pursued in the Unit generate colour pictures of spheres, for example pictures of molecules. After experimenting with a method which uses the painter's algorithm, a scan-line algo- rithm based on FILL3, except the data elements a re spheres and not polygon edges, w a s implemented. The routine accepts a list of coordinates of spheres and their radii. On each scan line two buffers a r e initialised. one contains pixel values (set to zero) and the other con- tains Z-coordinates (set t o a large nega- tive number) and the chord length of the sphere in the X-Y plane updated to this scan line ( the X-Y plane is the plane of the screen). For each sphere in the active sphere list a semicircle of points is computed [ 7 ] in the X-2 plane (perpen- dicular t o the screen). The program uses a 2-buffer algorithm. The colour and 2- coordinate a r e computed for each point on the semicircle. (The colour is com- puted by a user supplied subroutine.) The Z-coordinate of each point is com- pared with t h a t in the coordinate buffer and if it is greater the newly computed colour is stored in t h e pixel value buffer. On each scan line the buffer will contain, after the active sphere list has been exhausted, the pixel values of all spheres closest t o the viewer. These a r e plotted by PUTROW. Figure 9 shows the result of two invocations of t he routine to create a stereo pair. Notice t h a t the light source is no longer aligned along the viewing vector. This image contains about 12000 points which took about 2 minutes to compute and display. The stereo pair is computed by calling the routine twice, preceeding each call by setting up the appropriate GINO transformation.

8. Conclusions The extensions described have provided new features for CINO-M in a$ device- independent a manner a s possible. They a r e compatible with GINO; information is transformed and clipped etc. by CINO. Only a small number of extensions are needed to integrate a raster display into a general purpose graphics package.

These, however must be supplemented with more powerful routines, such as filling, to enhance the facilities provided by the package. Some of t h e enhance- ments cannot be provided in a com- pletely device-independent fashion. Our experience has shown that it is more important t o give the user control over what is generated on a particular device, r a the r than trying to provide completely

W e device-independent software. encourage users to code their program to take account of the device in use, for example call FILL on raster devices but HATCH on line drawing displays. Several projects a r e now actively engaged using these extensions.

9. Acknowledgements One of us (WTH) is employed under the terms of Agreement F/QSA/10 between the University of Manchester and the UK Science and Engineering Research Coun- cil. SERC support for t he work of the Unit is gratefully acknowledged. The Computer Aided Design Centre provided CINO-F under special licence. W e thank Bill Sowerbutts. Michael Trenouth. and Lydia Kaus for the use of their da t a to create the figures in this paper. We must also thank the users of t h e Unit's service for the inspiration and encouragement to design some of these algorithms.

10.

1.

2.

3.

4.

References

R.J. Hubbold and P.J. Bramhall, A Flexible High Performance Interac- tive Graphics System, ACM Com- puter Graphics, Vol 12, No 3, August

A.C. Arnold, A Communications Link between a PDP 11/45 and a n ICL 1906A/CDC 7600, Proc. DECUS Europe, Vol 7, No 1, September

CINO-F User Manual, Computer- Aided Design Centre, Cambridge, England, December 1976 G.H. Joblove and D. Greenberg, Colour Spaces for Computer Graph- ics, ACM Computer Graphics, Vol 12,

1978. pp 318-322

1980, pp 119-123

NO 3, August 1978, pp 20-25

Page 13: Raster Graphics at the University of Manchester

70 W. T. Hewitt, et el. f Raster Graphics at Manchester

5. W.M. Newman and R.F. Sproull, Prin- Display, ACM Computer Graphics, Vol

Graphics, (second Edition), N.Y. 7. J . Bresenham, A Linear Algorithm McGraw Hill 1979, pp 240-242 for Incremental Digital Display of

6. C.N. Judice, Display of Two- Circular Arcs, Communications of Dimensional Functions using Grey the ACM, Vol 20, No 2, February

ciples of Interactive Computer 9. NO 1 , 1975, pp 177-180

Scale Simulated on a Bi-level 1977, pp 100- 106