UNIVERSITY OF BRITISH COLUMBIA DEPARTMENT OF COMPUTER SCIENCE CPSC 414 (1997/98 Term 1) Computer Graphics Lecture Notes 01 -- Overview of Computer Graphics Reading Chapter 1: Introducing Computer Graphics (in the textbook) Defintion of Computer Graphics Computer graphics comprises the software and hardware techniques used to create visual displays for human viewing. This requires that we organize algorithms, data structures, and physical devices in a way that accomplishes the transformation from raw information on the computer to useful renderings on a screen or on paper in such a way that the display is useful. We need to employ knowledge from Mathematics, Physics, Psychology, Engineering, and Art and Design to accomplish this task. A Few Uses for Computer Graphics Today computer graphics is a standard component in almost all computer applications. Entertainment -- computer animation, special effects, computer/video games and theme park rides all utilize rendering, modeling, touch-up and background painting software based on computer graphics techniques. User interfaces -- GUIs (graphical user interfaces) are the dominant (UI) user interface for personal computers and workstations. Most GUIs use 2-D graphics and some advanced GUIs use 3-D graphics. Computer Aided Drafting and Design -- architecture, electronics, machining, and the aerospace and automotive industries use 2-D and 3-D graphics to build and analyze desings prior to manufacturing; simulations based on the design parameters are often presented as animated sequences or as VR (virtual reality). Health Care -- Patients are analyzed and diagnosed using graphical representations of information such as MRI (magnetic resonance imaging), CT (computed tomography) or ultrasound data; treatment or surgical planning is depicted using 3-D graphics; and pharmaceuticals are developed using sophisticated 3-D molecular modeling software that relies heavily on graphical representations of the underlying physics and chemistry. Cartography -- Most GIS (geographic information systems) utilize 2-D or 3D graphics for applications such as land use planning (zoning), weather or crop prediction, crime prevention, and political analysis. Interactive Plotting -- Business graphics packages use 2-D and 3-D plots to present statistical information, risk analysis, and many other types of information. Programs such as Microsoft Word, Excel and Powerpoint all have embedded in them standard plotting packages. Science and Engineering -- Visualization of data and computational models in 2-D, 3-D and even higher dimensions often requires sophisticated modeling and rendering software to produce interactive animated depictions of physical processes. A Brief History of Computer Graphics Many of the basic principles remain unchanged from the earliest applications of computer graphics, although there continue to be new developments that add to the list of tools as hardware and software continues to increase in complexity and sophistication. In 1950 a CRT (cathode ray tube) was used on one of the early computers (the Whirlwind) as in output device. (CRT-like devices were also used for storage in some early computers, but that wasn't really computer graphics.) The SAGE system developed for NORAD (North American Air Defense Command) in the 1950s and early 1960s included interactive graphics as a primary input/output technique for on-line operators. In 1963 Ivan Sutherland completed his PhD thesis Sketchpad at MIT, a milestone that most people consider to be the real beginning of computer graphics. Among the many ideas that Sutherland used in his system were: o component hierarchies in which sophisticated data structures represented more complicated objects as a collection of subobjects that allowed for instancing to make multiple copies of an object, each copy having separate attributes to determine its size and appearance. o constraint-based object modelling o interactive graphics using a special light-pen device in addtion to a standard keyboard Although Sutherland's system was only 2-D, a 3-D version was quickly made by Tim Johnson. These systems became the templates for many computer graphics systems in the decades that followed. Throughout the 1960's,computer-aided design (CAD) systems appeared, first for drafting, then as integral parts of the design and manufacturing cycle as simulation and visualization capabilities were added. 1967+ Tektronix introduces its Tektronix 4010 storage tube display. This has three features that cause a revolution: o It does not have to be refreshed, which meant that there was essentially no limit on the complexity of the drawings that could be displayed and it did not require a high-bandwidth connection to the CPU (it could run over slow RS-232 lines). o It used an encoding that was entirely within the regular ASCII character set and used none of the special control characters, so it would work with just about any operating system. o A set of FORTRAN subroutines, called the Plot10 package, provided a "standard" programming invironment that was relatively portable across mainframe computers (but of course only worked for the Tektronix storage tube graphics terminals, though it was later ported to other display devices). 1975+ Evans & Sutherland Corporation introduces its first 8-bit frame buffer. 1976+ Bitmapped graphics at Xerox PARC (Alto computer) + mouse, the desktop metaphor, windows, pop-up menus, cut/paste, direct manipulation (the GUI). Pixel: picture element. (also called a pel) teletypes and line printers (line printer art!) still majority until 1980's 1980's Bitmapped personal computer, Macintosh then PC 1985 Silicon Graphics Inc. Hardware accelerated graphics (the Geometry Engine) 1990's 2D and now 3D accelerators at PC level. Output Technology Calligraphic Displays o also called vector, stroke or line drawing graphics o lines drawn directly on phosphor display processor directs electron beam according to list of lines defined in a "display list" phosphors glow for only a few micro-seconds so lines must be redrawn or refreshed constantly deflection speed limits # of lines that can be drawn without flicker. Raster Displays o Display primitives (lines, shaded regions, characters) stored as pixels in refresh buffer (or frame buffer) (Figure 1.8) o Contents of the frame buffer altered either directly by main processor, or by specialized hardware (display controller). Actual interpretation of the contents of the frame buffer as a video signal is performed by the video controller. o Image stored as a raster, set of horizontal scan lines, each a row of individual pixels is scanned by the video controller in a specific order, top->bottom, left->right. (Figure 1.9) (electron beam is blanked during horizontal and vertical retrace). o VRAM chips simplify scan-line processing of memory and simultaneous access by display controller. o A frame buffer is characterized by is size, x, y, and pixel depth. the resolution of a frame buffer is the number of pixels in the display. e.g. 1024x1024 pixels. This is the spatial resolution of the buffer. the depth of the frame buffer is characterized by the amount of memory at each pixel. This determines the colour resolution of the buffer. Bilevel or monochrome displays have 1 bit/pixel (128Kbytes of RAM) Colour requires more. 8bits/pixel -> 256 simultaneous colours 24bits/pixel -> 16 million simultaneous colours Additional bits used to increase the speed/flexibility of the display. e.g. top-end SGI machine may have over 200bits/pixel: two 24bit image buffers, 32bit Z-buffer, 8 bit stencil buffer, 8 bit alpha-buffer, 16bit accumulation buffer, 8 bit overlay/underlay planes, 4 bits window id, 4 bits menu planes. Advantages to Raster Displays o lower cost o filled regions/shaded images Disadvantages to Raster Displays o a discrete representation, continuous primitives must be scanconverted (i.e. fill in the appropriate scan lines) o Aliasing or "jaggies" Arises due to sampling error when converting from a continuous to a discrete representation Display Technology o 2D Displays CRT LCD (raster) plasma screen (raster) Light valves (raster) Micromirror (raster) Projected laser (vector) Direct laser (vector) o 3D Displays Stereo presentation (raster/vector) Vibrating mirror (vector) Helical rotor (vector) LED plate (raster) Photoactive cube (raster) Parabolic mirror (raster) Cost/Speed o 1982. High-end 32bit 1024x1024 framebuffer $100,000+ o 1996. SGI O2 at ~6K US. 2.5M X11 Lines 583 3DVectors 366K Tmesh 191K Textured Tmesh Power Challenge 9.6 Million Tmesh Input Technology Keyboard Lightpen Digitizing tablet Mouse Touch panels The "Bat" Motion tracking Software Portability and Graphics Standards Graphics hardware now widely available on many platforms What about the software? o low-level device dependent supplied by manufacturer o high-level device independent packages (standard API for all progamming languages) 1977 3D Core Graphics System 1985 GKS (Graphics Kernel System) 2D version of Core 1988 GKS-3D 1988 PHIGS (Programmer's Hierarchical Interactive Graphics System) Supported hierarchical grouping of 3D components (called structures), + database Defacto or Industry Standards o Adobe Postscript o SGI OpenGL, OpenInventor o Microsoft's Direct3D o Ithaca Software HOOPS o MIT's X-windows (and PEX the 3D extension to X) SRGP (Simple Raster Graphics Package) Advantages of Interactive Graphics Humans are predominantly visual New medium for producing static images Unprecidented ability to produce new pictures fast! (extensive high-bandwidth user-computer interaction) o Motion dynamics: move tumble objects, camera zooms/pans/scrolls, close coupling with actuators (flight simulators, motion simulators, video games) o Update dynamics: actual change of shape, colour or other properties of objects being displayed. Conceptual Framework for Interactive Graphics Application Model <-> Application Program <-> Graphics System <-> Hardware o Application Model: represents data and object to be displayed/manipulated o Application Program: creates, stores, manipulates info about the model o Graphics System: receives output commands from program describing what is to be viewed and how the objects should appear. (input/output transformations) Programmer doesn't worry about how to produce the picture, deals with data structures and interaction. Application Modelling all data and objects, and their inter-relationships that are relevant to the display and interaction part of the application program and any non-graphical postprocessing (i.e. analysis) May have an associated application database. Display of the Model Model may be created from auxilliary data or as a result of interactive creation. Application models are independent of the display system, therefore must be converted to call a graphics subrouting library that is used to create the image. Routine correspond to various graphics primitives, attributes and elements. Interaction Handling Typically program has an event-driven loop. Program may or may not have to update internal state. Provides a sequential interface, many systems today provide concurrent interaction which may see the user involved in several parallel "conversations" with the application program. The Graphics Pipeline A fundamental concept in computer graphics is the idea of the graphics pipeline. The operations that are performed in rendering a scene given a description of the scene are almost always broken down into a number of discrete steps, each of which transforms the description of the scene into a simpler (not always smaller) representation that is closer to what the hardware can render. The order in which these steps are performed varies across systems, and some of the steps may not be performed at all, but most of the steps appear in just about any computer graphics system. Usually the graphics pipeline is primarily concerned with producing graphical output, but there is also an input pipeline which, often much simpler, is also important because input events must be transformed from the raw hardware level back to a meaningful representations in the application program and this requires ``undoing'' each of the steps performed in the output stages of the graphics pipeline. Input Pipeline Stage Application Model or Database Output These are the data structures and associated algorithms that describe a 3-D scene, including temporal behaviour and other characteristics). These data structures are often closely coupled to the application, with some aspects of the model being generic to lots of applications and Database Traversal Modeling Transformations other aspects being very specific to a particular application Software or hardware that traverses (walks) the (usually) hierarchical data structures to extract the specific information necessary to describe the geometric and other attributes of the scene. Often the hierarchical structure is preserved, but non-graphical information is discarded. The geometric transformations that map the information in the data structure through algorithms specific to the data structure that provide the instances of objects that comprise a 3-D scene in 3-D world coordinates CPSC 414 Lecture Notes | CPSC 414 Homepage /ugrad0/cs414/World/lectures/notes-01.html Tue Sep 8 17:43:14 PDT 1998