Introduction to Computer Graphics R. J. Renka Department of Computer Science & Engineering University of North Texas 01/16/2010
Introduction Computer Graphics is a subfield of computer science concerned with the creation and manipulation of images. It differs from image processing in that the emphasis is on image generation. Modern graphics API s include OpenGL, Direct3D, Java3D, Matlab, and others. Our programming environment will include C or C++, OpenGL, and GLUT (system-independent interface to OpenGL) on a workstation or laptop computer running Windows, Linux, or OS X. Graphics lends itself well to object-oriented programming, but since OpenGL is not object oriented, and we do not want to hide low level details, procedural code is preferred.
OpenGL OpenGL (Open Graphics Library) is a software interface to graphics hardware. OpenGL is hardware independent and must therefore be implemented on different hardware platforms. Since it is independent of the windowing system, it requires either platform-dependent function calls or a platform-independent interface such as GLUT (GL Utility Toolkit). OpenGL includes 3-D, realism, and animation, but it is low-level in the sense that models must be built from simple geometric primitives (points, lines, and polygons). The functions in GLU (OpenGL Utility Library) are higher level.
OpenGL continued In an X Windows implementation, OpenGL is designed for a network environment in which the client and server may run on different machines with the server running locally. OpenGL is a state machine. The state or mode is changed by changing state variables such as the current drawing color, geometric transformations, etc. All state variables have default values. OpenGL has bindings to C/C++, Fortran 90, Ada, Java, Perl, and Python.
Graphics Subfields The study of computer graphics can be partitioned into three subfields. Modeling Mathematical specification of shape and appearance, such as a triangle mesh surface and reflection model. Rendering Creation of shaded images from 3-D computer models. Animation A technique to create the illusion of motion by time-sequencing rendered images.
Related Fields Related fields include the following. User Interaction Interface between user input devices and an application program. Virtual Reality Attempt to immerse the user in a 3-D virtual world using stereo graphics, response to head motion, sound, haptics (force feedback), etc. Visualization Provide insight into data via visual display. Image Processing Manipulation of 2-D images. 3-D Scanning Use of range-finding to create 3-D models.
Applications Video games: simulations without the need for high accuracy. Movie special effects such as digital compositing (superimposed backgrounds with separately filmed foregrounds) or computer-generated foregrounds. The first full-length computer-generated film was Toy Story in 1994. CAD/CAM (Computer-aided Design/Manufacturing): mechanical parts and products are designed by a 3-D modeling package and produced by a computer-controlled milling machine. Simulation Medical imaging: creation of shaded images from scanned patient data. Visualization Paint programs, Art Word processing and desktop publishing Business graphics: graphs and charts GUI s
A Brief History of Graphics Hardware 1950 s: Line printers and pen plotters Both are limited to monochrome hard copy in batch mode. The line printer is a low-resolution raster scan device characterized by sequential access. Gray shades are produced by overstriking. The pen plotter is a high-resolution vector graphics or random-scan device in which the primitives (lines or vectors) are stored as a sequence of commands and endpoint coordinates. mid 1960 s: Vector system consisting of a CRT, display buffer, and display processor late 1960 s: Direct-view storage tube (DVST) (Tektronics terminal) a monochrome CRT with long-persistence phosphor which eliminated the buffer and refresh process early 1970 s: CRT-based raster systems based on TV technology late 1970 s: PC, Dot matrix printer, and light pen 1980 s: Graphics workstations, coprocessors, laser printers, mouse, audio
CRT-based Raster System The advantages of CRT-based raster systems over CRT-based vector systems are the following: 1 Lower cost 2 Color-filled polygons (essential for realism) 3 A simple refresh process independent of image complexity The disadvantages are as follows: 1 Scan conversion of lines is expensive and must be done every time the image is transformed 2 Aliasing (jaggies, staircasing) The aliasing problem is mitigated by antialiasing techniques, such as varying pixel intensity values by distance from a line segment or polygon edge. This requires a gray-scale or color system with several bits per pixel.
Raster Display Hardware A bilevel monochrome CRT (Cathode Ray Tube) is a glass tube containing an electron gun, a phosphor-coated negatively-charged surface, and a yoke a system of electromagnetic coils which deflect the electron beam horizontally and vertically. A color TV or RGB monitor is a CRT with three electron guns, a shadow mask to improve focus, and discrete sets of red, green, and blue phosphor dots in place of a uniform phosphor coating. Raster scan is a scanning method in which the electron beam sweeps out a fixed path at fixed speed controlled by two oscillators horizontal and vertical. Horizontal scanning frequency (scan rate, synchronization rate) is typically 12 to 120 Khz (15.75 Khz for TV), where a cycle includes a forward sweep (left to right) in which the electron beams are switched on and off for each pixel, and a horizontal retrace with the beams off.
Raster Display Hardware continued Vertical scan frequency, including a vertical retrace, is nominally 60 Hz (NTSC: National Television Standards Committee) or higher for monitors (70 or 72). Standard TV and some monitors use interlacing in which only half of each frame (refresh buffer contents) is displayed in each vertical cycle, resulting in a refresh rate of 30 frames/sec. This doubles the number of scan lines that can be displayed to less than (15750 h-cycles/sec)/(30 frames/sec) = 525 h-cycles. In order to reduce flicker, the scan lines are interlaced all even numbered lines in one vertical cycle followed by all odd numbered lines in the next. The alternative (noninterlaced mode) requires higher frequency which implies more expensive hardware. The vertical resolution (number of scan lines or rows of pixels) is less than 525 because some of the horizontal cycles occur during the vertical retrace. Also, there is a border or overscan area pixels and scan lines not mapped to memory.
Raster Display Hardware continued Phosphor persistence is the time from removal of excitation to the moment when phosphorescence (intensity) drops to 10% of its initial value (exponential decay): typically 10 to 60 ms or, roughly, short, medium, or long persistence. Critical fusion frequency (CFF) is the refresh rate (number of image redraws per second) at which the image stops flickering and fuses into a steady image. It depends on 1 phosphor persistence (nonlinearly): high persistence reduces CFF or flicker at a given refresh rate, but is problematic for animation 2 image intensity and ambient room light: CFF increases with both 3 wavelength 4 the observer by up to 20%
Raster Display Hardware continued Video bandwidth (pixel rate) is the frequency with which the electron beam is switched on and off. It determines the resolution rather than speed. Standard TV frequency is 14.318 Mhz, limiting the horizontal resolution to less than (14318000 pixels/sec)/ (15750 scanlines/sec) = 909 pixels per scan line.