Computer Graphics

882

Click here to load reader

description

useful for engineering students

Transcript of Computer Graphics

  • Computer Graphicswith OpenGL

    - - - -

  • Computer Graphicswith OpenGL

    Donald HearnM. Pauline BakerComputer Science Department and Pervasive Technology LabIcr Visualization and In teractive Spaceslndiana Unitersitv-s-I'urdue Unhoersirll

    ~ .

    PEARSON

    --Prenurensn .

    Pearson Education International

  • Viet' Pres ident and Editorial Director. ECS: Afarcw}. Hl!rtmrPubl isher: A/ml R. AptAssociate Ed itor: T oni DionneHolmEditorial Ass istan t: PilI rick LindnerViet> President an d Director o f Prod uction

    an d Manufacturi ng. ESM, Drrl'id W. RiccardiE).,'t"utiv!:' M.m aging Ed itor: ViH,'C O'Bri,'I!\ t lM ag ing Ed itor: Crlmille Tm rtarosfeProduct io n Editor: K.1t.11Y Ewi'lgProd uction Assistan t: Daniela PetrilliDirec to r of Creative Services: {'auf EklfmitiCrea tive Directo r: Caroll' Am~l/IArt Director. Heather 5(1)11Cover Designer: lcltu C;'ri~l im l rl

    Interior Dl'Sih"Tler: Cnnnclia PereiraCover Image: ClJllrfl'S.l! lJf Deborah R. Fouler, Pr:emy~lrHi'

    Prusi"illki'"i"ir.., (I'ld IV/wll'les Brltt j l.'5,Ull hlfrsi!y ('/ e ll/S'lry. to 1992.

    Milnagi ng Ed itor, AV Milnagl?mt>ntand Production: Patricia B!ml~

    Art Edi tor: Xil1ll1hlllg ZIIlIImage Resea rcher: Knthryll Kns tU ri1:iImage Permiss ion Coo rdi nators: }omlllf Vippd

    alld CYIlt/lill VincentIMa nu facnmng Manager: Trlj,/YPi~ciofliMauufactunng Buyer: Lynda Glsti!lllMarketin g Ma nager: P,lm

  • To Our FolksDwight, Rose, Jay. and Millie

  • Contents

    Preface XIX 2-2 Raster-Scan Systems 50 Video Controller 50 Raster-Scan Display Proces sor 52

    .. ASurvey of Computer 2-3 Graphics WorksL.l tions and viewingSvstems 5~Graphics 2 -2-1 Input Devices 57

    1-1 Graphs and Chart.. 3 Keyboards. Hutton Boxes, and Dials 571-2 Computer-Aided Design - Mouse Devices 57, 1-3 Virtual-Rcalitv Environments 10 Trackballs and Spaceballs 591-1 Data Visua liza tion'.. 12 Joysticks 591-5 Ed ucation and Training 19 Data Gloves

    '"1-6 Computer Art 23 Digitizers no1-7 Ente rtainm ent 18 Image Scanners 621-8 Image Processing 31 Touch Penel M1-9 Graphical User Interfaces 32 l ight Pens 65

    1-10 Summary 33 Voice Systems 65References 33 2-5 Hard-Copy Devices Of>

    2-6 Graphics Networks 682-7 Graphics on the Internet 68II Overview of Graphics 2-8 Graphics Software n9

    Coord inate Represen tations 69Systems 34 Graphics Functions 71

    2-1 v ideo Display Devices 35 Softw are Standard!'> 72 Refresh Cathode-Ra y Tubes 36 Othe r Graphic. Packages 73 Raster-Scan Displays 39 2-9 Introduction to ClpffiGL 73 Random-Scan Displays ~l Bask Ope-nGL Syn tax 7~ Co lo r CRT Moni tors ~2 Related Libraries 7~ Flat-Panel Displays ~ Header Files 75 Three-Dimensional Viewing Devices ~7 Display-window Management Stereoscopic and Vi rtua l-Real ity Us ing GLUT 76

    Systems 18 A Co mplete OpcnGL Program 77

    VII

  • Viti C""/('III~

    2-10 Summarv ~I Splittinga Convex Polygon in to a SetReferences 82 of Triangles 127Exercises 82 Inside-Outside TI.'Sb 127

    Polygo n T.lble:. 129 Plane Equa tions 131 Front and Back PolygonII Graphics Output Faces 132

    84 3-16 O pcnGL Polygon Fill-AreaPrimitivesrunc tions 13-1

    3-1 Coordina te Refe rence Frames 86.1-17 OpnG L Vertex Arrays 139

    Screen Coordinates 86 J-18 Pivel -Arrav Prtmittves 142 Absolu te and Relative Coord inate 3-19 Cpl'nGL Pixel-A rray

    Speci fications R7 Func tion s 1433-2 Specifying a Two-Dimensiona l OpcnGL Bitmap Function t.l 3

    world-Coord inate Reference Openrj t. Ptxmap Function 14.5

    Fra me in O ptmC L ~7 OpenGL Raster Operations 1163-3 OpenGL Poin t Functions

    "" 3-20 Cha racter Primitive s 1-173--1 OpenGL Line Functions 91 3-21 Opt>nG L Character Functions 1 ~93-5 Line-Drawing Algorithms 92 3-22 Picture Partitioning 151

    Line Equa tions 93 3-23 OpcnGL Display Lists 151 DDI\. Algorithm 9~ Crea ting an d Naming .10 OpcnG L Bresenham's Line Algorithm 95 Display List 15 1 Displaying I'olyhncs 99 Executing OpenG L Displa y Li sts 152

    3-b Parallel Line Algori thm!' 99 Deleting Opt>nGL Display Lists 153H Setting Frame-Buffer va lues 101 3-14 O penGL Di..-plav-window Reshape3-8 OpcnGL Curve Functions 102 Function 13-13-9 Circlc-Ccncrating Algorithm... 103 3-2.'i Summarv 157

    Properties of Circles 103 Example Progra ms 160 Midpoi nt Circle Algorithm 105 References 168

    3-10 Bllip se-Cencrattng Algorithms 109 Exercises 1"~ Properties of Ellipse''' 109 Midpoint Ellipse Algorithm 11 0

    3-11 O ther CurvC51 117 II Attributes of Graphics Conic Sections 11 7 Polynomials and Spline Curves 119 172Primitives3-12 Parallel Curve Algorithms 119

    3-13 Pixel Addres sing and Objec t 4-1 ~nGL Stol te Variables 174Ccome try 120 ~-2 Color and Gray Scale l i4

    Screen G rid Coordinates 120 RC.B Color Compo nents 174 Malnta lnlng Ccometric Properties Color Tab les l i 5

    of Displayed Objects 121 Crav Scale 1763-14 Fill-Area Primitives 12.1 Other Color Parameters l in3-15 Polygon Fill Areas 12~ 4-3 OJ.x-nG L Colo r Functions 177

    Polygon Clcssi f lca tion, 12~ The OpcnGL RGB and RGll A Color Identifying Concave Polygons 125 Modes 177 Splitting Concave Polygons 125 Of.~nGL Color-Inde x Mode 17R

  • Contents"

    OpcnGL Color Blending 17'i Antiahaslng Area Opt"nGL Color Array !'; ISO Boundaries 219 Other OpenGL Colo r Functions 1HZ 4-18 Op,..nGL An ualiasing

    4-1 Point Attri bu tes 183 Functions 2214-5 Lin" At tribu tes 183 4-19 Opt>nGL Query Func tions 222

    Line Wid th liB -1-20 O penG L Attribute G roups 223 Lin t> Sty I,,' 185 4-21 Summary 224

    Pen

  • Two- Dimensiona l Rigid-Body Refereno.."s 293Transformation 2" Exercises 293

    Constructing Two-DimensionalRotati on Matrices 248

    Twe-Dimensional Composite-Matrix 1:1 Two-DimensionalProgramming Example 2485-5 O ther Two-Dimensional Viewing 296Transformations 253

    Reflection 253 &-1 TIlt' Two-Dimensional Viewing Shea r 253 Pipeline 297

    % Raster Methods (or Ceometric &-2 The Clipping Window mTransformations 257 Vlewing-Coordtnate Clipping

    .. OpcnGL Raster Window 3000-'Transforma tions 258 World-Coordinate Clipping Window 3005-~ Transforma tions Between &-3 Normalization an d Viewport

    Two-Dimensional Coordinate Transformations 301Sys tems 259 Mapping the Clipping Wind ow into

    5-9 Gt'tl mt>tric Tr ansfo rmations in a Normalized viewport 301Three....Dimensiona l Space 261 Mapping the Clipping Window into

    5-10 Thrcc-Dimenslona! Translation 2h2 a Normalized Squan.. 303

    5\\ Turcc-Dirncnstooat Rotation 263 Disp\a.y oi Character String..; 305Three-D imensi ona l Coordinate-Axis Split-Screen Effects and MultipleRota tions 26-1 Output Devices 3Q,

    General Three... Dimensional 6--1 OpenGL Two-Dimensional Viewi ngRotations 266 Functions 305Quaternion Methods for ~nGL Projection Mode 3Q6Thn...c -Dimcnsiona l Rotations 272 GLU Clipping-Wind ow Junction 306

    5-12 Three-Dimensional Scaling 275 OpcnGL viewport f unction 3075-13 Composite Three- Dtmenstonal Creating a GLlIT Display Window 307

    Transformat ions 278 ~tting the GLUT Display-window5-14 Other Three-Dimensional Mode and Color 30~

    Transformations 281 GLUT Display-Window Identifi er 309 Three -Dimensional Reflections 281 Deleting a G LUT Display Window 301,1 Three-Dimensio nal Shea rs 281 Current GLUT Display w indow 309

    5-15 'Transform ations Between Relocating a nd Resizing a GLL'TThree-Dimensional Coordinate Display window 309Systems 282 Managing Multiple GLUT Display

    5--16 Affine Transformations 283 Wi ndows 3105-1 7 0 pl'nG l Ccometnc-Transformation GI.UI Subwindows 311

    Functions 283 Selecting a Display-Window Basic OpenGL Geometric Screen Cursor Shape 311

    Transformations 281 Viewing Graphics Objects in a GLUT OpcnGL Matrix Operations 285 Display Window 311 OpcnGL Matrix Stacks 287 Executing the Applica tion Program 312 OpcnCL Geo me tric-Transform at ion O ther GLUT Functions 312

    Progra mming Examples 21\8 Opt'nGL Two-Dimensional Viewing5-18 Summary 2~1 Program Example 313

  • ("..nll le ll ls"

    &-5 C lipping Algorithms 315 Thto' Vito'\\'-LTp Vector 3526-6 Two- Dimensional Point Clipping 315 The uvn Viewing-Coordina te&-7 Two-Dimensional Lim..' Clipping 316 Reference Frame 353

    Cohen-Sutherland Line Clipping 317 Cencroting Three-Dimen sional Liang-Barsky Line C lipping 322 Vi ewing Effects. 353 Nichol-Lee-Nichol Line Clipping 325 7-1 Tra nsformation from w orld to Line Clipping Using Nonrectangular Viewing Coordina tes ill

    Polygon Clip Windows 32H 7-5 Projection Transform atlons 356 Line Clipping Using Nonlinear 7-6 O rthogona l Projections 357

    Clipping-w indov...' Bounda ries 329 Axonometric and Isometr ic6-8 Polygon Fill-Area Clipping 329 O rthogonal Projections 358

    Sutherla nd-Hod gma n Polygon Orthogonal Projection Coord inates 338Clipping 331 Clipping \\ lnd ow and

    wel ler-Atherton Polygon Cllpplng 3..1..:; Orthogonal-Projection View Volume 359Polygon Clipp ing Using Norma lization Transformation for a nNonrectangular Polygon Clip O rthogonal Projection 360windows 337 77 Oblique Parallel Projec tions 362

    Polygon Clipping U:oin:o; Nonl inear Oblique Para lle l Projections inClipping-Window Boundaries 338 Drafting and Des ign 362

    6-9 Curve Clipping 338 Cavalter a nd Cabinet Oblique6-10 Text Clipping 339 Parallel Projections 364&-11 Su mmary 340 Oblique Parallel-Projection Vector 364

    References 342 Clip ping Window and Oblique

    Exercises 313 Parallel-Projection View Volume 366 Oblique Parallel-Projection

    Tran sto rrna tion Matrix 366

    II Three-Dimensional Normalization Trans formation for a n- Oblique Paral lel Projection 367Viewing 344 7-s Perspective Projections 368

    Perspective-Projection7-1 Overview of Three- tJtmenslona l

    Viewing Conce pts 3-15'lransfo rmat lon Coordina tes 368Perspective- Projection Equations :

    Viewing a Three-Di mensional Special Cases 369Seem: 345

    Va nishing l'oin ts for Perspective Projections 316 Projections 370 Depth Cueing 3-l6

    Perspective....Projection view Volume 371 Ident ifying Visible Lines a nd

    Perspective- ProjectionSurfaces 3-17Surface Ren dering

    Trans formation Ma trix 373 315

    Symmetric Perspective-Projection Exploded and Cuta way Views 318 Fru -stum 374 Three-Dimensional and Stereoscopic Oblique Perspec tive-Projection

    Vie wing 34H Fru stum 3787-2 The Three-Dimensional Viewing Normalized Perspcctive- l'rojection

    Pipeline J.lH Transformation Coo rd ina tes 3HO7-3 Thrcc-Dimensional 7-9 TI1C Viewport Tra nsforma tion and

    Viewing-Coordina te l'arameters 351 Three -Dimensional Screen The view-Plane Normal Vector 351 Coord inates 382

  • ,,, CI.mkl l t ~

    7-10 OpenGl Three-Dlmcnslonal B-5 Supcrquadncs 410Viewing Functions 38J Supcrolli..esc 410

    OpenGL Viewing-Transforma tion Supc rcllipscld mFunc tion 3&1 H O pe-nGL Q ua dric-Surface andOpenr.l, Orthogonal-Projection Cubic-Surface Function... mPunction

    GLUT Quad ric-Surface Functions 412 OpenGL Symmetric

    e lL"T Cubic-Surface TeapotJ'e rspcctive....Projection Function 386 Function 413

    OptnCoI . General GlU Quadric-Surface Functions 414

    Perspective- Projection Function 386 Example Program Using GUJ I and

    Opt'I1G L Viewports and Display G LU Quadric-Surface Functions.. 416w indows 387OpenGL Three-Dimcnstorwl

    1\-7 Blobby Objects 418

    Viewing Progra m Example 387 8-8 Spline Representations 420

    7-11 Three-Dimensiona l Clipping Interpolation and Approximation

    Algorithms 38" Spli nes420

    Clipping in Three...Dimensional Parametric Continuity Cond itions 42 1Ho mogeneous Coordinates 3m Ceornetnc Continuity Conditions 422

    Ihree-Di men..tona l Region Codes 390 Spline Specifkanons 423 Three-Di men siona l Point and Line Spline Surfaces 424

    Clipp ing 3" 1 Trim ming Spline Surfaces 424 Three...Dimensiona l Polygon 8-9 Cubic-Spline In terpolation

    Clipp ing 39.+ Methods -125 I hree-Dimension al Cu rve Clipping 395 Natura l Cubic Spl ines 426 Arbitrary Clip ping Planes 395 Hermite In terpolation -126

    7-12 OpenGl Optional Clipping Plante'S 397 Cardi na l Splines 4297-13 Summarv 398 Kochanek-Bartels Splines 431

    Rcfereuc ..~ 400 810 Ht\zil'r Splint" Curves 432Exercises 400 Bezier Curve Equa tions 433

    Example Bezicr Curve-Gene ra tingProgra m 435II Three-Dimensional Object Propert ies of Bezler Curves 437 Design Techniques Using Bezier

    Representations 402 Cu rves 4381\-1 Polyhed ra Cubic Bezie r CUTv e~ 439-lO48-2 OpenGl Polyh edron Functions -lO4 8-11 Bealer Surfaces 441

    OpenGl Polygon Fill-Area Functions -lO4 8-12 BSplim' Cu rves 442

    C UJT Regular-Polyhedron B-Splim. Curve Equations 4.12f unction s 40-1 Uni form Peri od ic a -Spline CUf\ 'CS 4. 4

    Example G t.. lIT Polyhedron Progra m -1116 Cubic Periodic H-SplinE" Curves 4.71\-3 Curved Su rfaces

    -1118 Open Uniform lJ-Sp lin(' CUT\'PS 4-lH8-l Quadric Surface, -Hl8 Non uniform It-Sp linE' Curves . 51

    Sphere -Hl8 8-13 H..Splmc Surf.1C'E'S .-',- EI Ii~id -Hl8 8-14 Ik~ t .1 Spl ine.. 432 TocU5 -109 Beta-Spline Continuity Condit ions -l52

  • Cubic Periodic Beta-Spli ne Matrix Visual Representa tions fo r Vec torRepresentation 453 Fields. 517

    8-15 Rationa l Splines 454 Visual Representa tions fo r TensorField s 519ll-\6 Conversion Between SplineVisual Represen tations fo rRepresentations 436 Multiva riate Data Fields 5208-17 Displaying Spline Curves and 521Surfaces 437 R-28 Summary

    H orner 's. Rule 457 References 524Porward-Di fference Calculations 15~ Exercises 525

    Subdivision Methods 459

    &-18 OpenG L Approximation-Spline II Visible-Surface DetectionFunctions 46\ O penG L Bezier-Splme Curve 528Functions 462 Methods OpcnGL Bozter-Sphne Surface 9-\ Classif ication of Visib le-Surface

    Functions 465 Detection Algorithms =-"9.-GLU B-Spline Curve Functions 467 Back-Face Detec tion . ')() 9-2 ,.

    GLU B-Spline Surface Functions 469 9-3 Depth-Buffer Method 53\ GLU Surface-Trimming Functions 471 9-4 A-Buffer Method 55-l

    8-\9 Sweep Rep resen tations 473 9-5 Scan-I_inc Method 5358-20 Constr uctive Solld -Ccometry 9-6 Depth-Sorting Method 537

    Met hods 174 9-7 USP-TrC(" Method 3-:108-21 Octrccs -li 6 9-8 Area-Subd ivision Method 541

    8~22 BSP Trees 479 9-9 Oc trcc Methods 5438-23 Practal-Ceo metrv Methods -Ii"} 9-10 Ray-Casting Met hod 541

    Fractal Genera tio n Pr ocedures 481 9-11 Comparison of Visibility- Iktection Clas..ifica fion of Fracta ls 4~1 Methods 5-15 Frac tal Dimension 482 9-12 Curved Surfaces ;45 Ceometrtr Cons truction of Curn~d-Surface Represen tations 5.j6

    Deterministic Self-Simi lar Fractals Su rface Contour Plo ts 546

    Geometric Const ruction of 9-13 Wire-Frame Visibi lity Me thods 547Sta tistically Self-Similar Fractals 487 Wire-Fra me Surface-Visib ility

    Affine Fractal-Construction Method s 489 Algori thms 547 Rand om Midpoin t-I) jsplacemen t Wire-Frame Depth-Cueing

    Methods -190 Algorithm 5-l8 Controlling Terrain Topograp hy 493 9-1-1 OpenG L Visibility-Dctl.:ction Self-Squa ring Fractals -N ; Functions 54:9 Self-Inverse Fracta ls S06 OpenGL Polygl)fl-Culling Functions 5-19

    8-24 Shape Gra mma rs and Other O pcnG L Dep th-Butter Functions 549Procedura l Methods 307

    0 rt'nG L Wirt:-Framc8-25 Particle Svstems 510 Surface-Visibility Methods 5518-26 Physica lly Based Modeling 511 OpenGL Depth-Cueing Function 5,';28-27 Visuali zation of Da ta Sets 514 9-15 Summary 552

    visual Representa tions for Scala r l{efr:>fPnces 533Fie lds 514 Exercises 554

  • ,~ Ctmtr'llf5

    10-10 Polygon-Rend ering Methods 5911m Ill umination Models and Cc ns tan t-ln ten siry SurfaceRendering 591Surface-Renderi ng

    Couraud Surface Rendering 592Methods 556 Phong Surface Rendering 595

    10-1 Light Sources 558 Fast Phong Surface Rendering 593 Point Ligh t Sources 55H 10-11 Ray-Treeing Methods 597 ln fimtely Dis tant Light Sources 559 Basic Ray-Tracing Algorithm 597 Radial Intensity Attenua tion 559 Ray-Surface Intersection Directional Light Sources and Calculations 601

    Spotlight Effects 360 Ray-Sphere In tersec tion.. 602 Angular Intensity Attenuation 561 Ray-Polyhed ron Intersection.. 603 Ex tended Light Sources and the Warn Rf1.111dn~ Object-Intersec tion

    Model 502 Calculation ... 6Q.410-2 Surface Lighting Effects 563 Space-Subdivtston Methods 60310-3 Basic Illumination Models 503 Simulating Came ra Focusing Effects 607

    Ambient Light 563 Antlal lased Ray Tracing 610 Diffuse Reflection 36l Distributed Ray Tracing 612 Spec ular Reflection and the l'hong 10-12 Radiosity Lighting Model 615

    Model 567 Radiant-Energy Terms 616 Combined Diffuse and Specula r The Basic Radloslty Model 616

    Reflections 571 Progressive Refinement Rad iosity Diffuse and Specular Reflections Method 620

    fmm Multiple Light Sources 571 10-13 Environment Map ping 623 Surfarr- Light Emissions 571 Photon Mapping 624lO-H B

  • Contents xv

    OpenGL Directional Light Sources Valua tor Devices 671(Spotlights) 64iI 0 Choice Devices (i71

    OpenGLGlobal Li ghting Parameters 6-11 0 Pick Devices (i- 'I .0 OpenGI_Surface-Property Funct ion 6-12 11-3 Input Functions for Graphical Data 6730 OpeonGL Illumina tion Model 6-1 3 0 Input Modes 67~ OpenGL Atm ospheric Effects 6-14 Echo Feedback "7~ OpenGL Transparency functions 6-15 Callback Functions 67~ OpcnGL Surface-Rendering 11-6 GLlTf Keybo ard Functions 6114 Of't'nGL Texture Subpa tterns 6...~7 GLUT Tablet Funct ion.. 689 OpenCL Texture Red uction Patterns 637 GLUT Spaccbal! Functions 6llY Opt-nC L Texture Borders Ii>ll GLCT Button -Box Function 690 Ope-nGL Pro xy Textu res 639 GLLT Dial:. Func tion 6'Xl Automatic Textu ring of Quadric - OpenC L Picking Operations 690

    Surfaces 659 11-7 OpenGL Menu Funct ions (i96 Homogeneous texture Coordinates 659 Creating a G LUT Menu (i960 Ad d itional Opcn'Sl, Textu re Options 66D Creat ing and Managing Multiple0

    10-22 Sum mary 660 GI.UT Menus (,99Refe rences 664 Crea tin g G LUT Submenus 71\)Exercises 665 Modi fying GLU l' Menus 703

    11 -5 Design ing a Gra phical Lser Interface 703 The User Dia logue 703m Interactive Input Methuds Windows and Icons 7().l Accommoda ting Multiple Skill

    and Graphical User Levels 7().lInterfaces 668 Consistencv 705

    Minimizing Memoriza tion -0-11 -1 Gra phica l Input Da ta 669 1 ,

    11-2 Logical Classi fication of Inp ut Backup and Error Hand ling 705Devices 669 Feedback 705

    Locator Device.. 670 I H Su mmary 70fl Stro ke Devices 670 References 709 String Dev ices 670 Exercises 709

  • xv Ctmtr'l!!s

    Double Buffering 734lEI Color Models and Color Generating A nimations Using RasterOperations 735712Applications

    13-2 Design of Animation Sequences 73S12-1 Propertiesof Light 713 13-3 Traditional Animation Techniques 737

    The Electromagnetic Spectrum 713 134 General Computer-AnimationPsychological Characteristics of Functions 737Color 715 13-5 Computer-Animation Languages 738

    12-2 Color Models 7]6 13-6 Key-Frame Systems 739 Primary Colors 716 Morphing 739 Intuitive Color Concepts 716 Sim ulating Accelerations 742

    12-3 Standard Primaries and the 13-7 Motion Specifications 743Chromaticity Diagram 717

    Direct Motion Specification 745 The XYZ Color Model 717

    Goa l-Directed Systems 745 Normal ized XYZ Values 718

    Kinematics and Dynamics 746 The ( IE Chromaticity Diagram 718 13-8 Articulated Figure Animation 747 Color Gamut.. 719 13-9 Periodic Motions 748 Complementary Colors 719 13-10 OpenGL Animation Procedures 749 Dominant wavelength 719 13-11 Summary 752 Puri ty 720 References 754

    12-4 The RGB Color Model 720 Exercises 75412-5 The YlQ and Related Color Models 722

    The YIQ Parameters 722 Transform ations Between RGB and II! Hierarchica l Modeling 756YIQ Color Spaces 722 The YUV YCrC~ Systems 723 14-1 Basic Modeling Concepts 757

    12-6 The CMY and CMYK Color Models 723 System Representa tions 757 The CMY Parameters 723 Svmbol Hierarchies 759 Transformations Between CMY and

    14-2 Modeling Packages 760I~GH Color Spaces 72414-3 General Hierarchical Modeling12-7 Thp HSV Color Mode l 724 Methods 762

    The HSV Parameters 724 Loca l Coordinates 763

    Selecting Shades, l ints, and Tones 726 Modeling Transformations 763

    Transformations Between HSV and Creating Hierarchical Structures 763RGB Color Spaces 726

    14- 1 Hierarchical rvfodcling Using12-8 The HLS Color Mode l 728 Opt>nGL Display Lists 76512-9 Color Selection and Applications 728 14-5 Summary 765

    12-10 Summary 730 References 766References 731 Exerci ses 766Exercises 731

    1m Graphics File Formats 768lEI Computer Animat ion 73 215-1 Image-File Configurations 769

    13-1 Raster Methods for Computer 15-2 Color-Reduction Methods 770Animation 734

  • Contents xvii

    Uniform Color Reduction 770 Standard Three-Dimensional Popu larity Color Reduction 771 Cartesian Reference Frames 70'9 Median-Cut Color Red uction 771 Three-Dimensional Cartesian Screen

    15-3 File-Compression Techniques 771 Coo rd inates 7YORun-length Encod ing m Three...Dimensiona lLZW Encoding 112 Curvili near-Coo rd inate Svstcms 790

    Solid Angle 791 Other Pattern-Recognition

    A-2 Points and Vectors -9'Com pression Methods 773 I Point Prope rties - 9'

    Huffman Encod ing 773 I Ari thmetic Encod ing 776 Vec tor Properties 792Discrete Cosine Trans form 776 Vex tor Ad di tion and Scalar

    15-4 Composi tion of the Major File 1\1ul tlplication 79,1Formats 778 Scalar Product of Two Vectors 794JPEG: Joint Photographic Experts Vector Prod uct of Two Vectors 795Group 779 A-3 Tent'(lr~ 7%

    CG~1: Computer-Graphics Metafile A-I Basis Vectors and the Metric Tensor 7%Forma l 780 Determining Basis Vec tors for a

    TIFF: Tag Image-File Format 781 Coo rd inate Space 7% PNG: Por table Nctwork-Cra ph lcs Orthonormal Basis 797

    Forma t 781 Mplric Tensor 79H XBM: X Window System Bltmep .'\-5 Matrices 799

    Format & XP~1: X ""indow Svstem Scalar Multiplication and Matrix

    Pixmap Format 781 Add ition SOO Adobe Photoshop Forma t 782 Matrix Multlplic..ation 800 MacPaint: Macintosh Pain t Format 782 Matrix Trans pose 801 PICT: Picture Data Format 782 Determinan t of a Matrix 801 B\IP: Bitmap Format 782 Ma trix Inverse 802 PCX: PC Paintbrush File Format 783 A-6 Complex Numbers 802 TGA: Truevislon Graphics-Ada p ter Basic Complex Ari thmetic 803

    Forma! 783 Imagina ry Unit 803

    GlF: Gra phics Interchange Format 783 Com plex Conjuga te and Mod ul us of15-5 Summary 783 a Complex Number 804

    References 7M Complex Division 804Exercises 7&1 Polar-Coordinate Represe ntation for

    a Complex N umber 805A -7 Qua temions 803II Mathematics for A-R Nonparametric Representa tions 807A -I:) Parametric Representations 807Computer Graph ics 787 A-10 Rate-o f-Change Operators 80H

    ,-\ . ) Coord ina te Reference Frames 787 Grad ient Operator 809 Two-Dimensional Cartes ian Screen Direc tional Derivative 809

    Coord ina tes 7~7 General Form of the Grad ient Standard Two-Dimensiona l Opera tor 810

    Cartesian Reference Frames 788 Laplace Opera tor 810 Polar Coordina tes in the xy Plane 788 Divergence Opera tor 810

    Curl Operator 811

  • xvii i Contents

    A-11 Rate-of-Change lntcgrol Evaluating Integrals 820Transforma tion Theo rems 811 Solving Ordinary Differen tial

    Stokes's Theo rem 811 Equations 822 Green 's Theorem for a Plane Surface 812 Solving Partial Differential Equations 824 Divergence Theorem 813 Least-Squares Curve-Fitting Green's Transforma tion Equations 8H Methods tor Data Sets 82-::;

    A-12 Area and Centroid of a Polygon 8H Bi bliogra phy 827 Area of a Polygon 814 Subject Index 839 Cent roid of a Polygon 81S OpenGL Functio n Index 8Sh

    A-13 Calcula ting Properties of Polyhedra 81i Core Libra ry Functions 85hA-14 N umcrlcal Methods 817 CLU Functions 837

    Solving Sets of Linear Equations 817 GLUT Functions 837 Finding Roots of Nonlinear

    Equa tions 819

  • cPreface

    omputer graphics remains one of the most excltlng and ra pid lygrowing areas of modern technology. Since the appearance of thefirst edition of this book, computer graphics has become a standardfeature in applications software and computer systems in general.Computer-grap hics methods are rou tinely applied in the design of

    most products, in training sim ula tors, in the production of m usk vid eos andtelevision commercials, in motion pictures . in data analysis, in scientific stud -ies. in med ical proced u res, and i ll numero us other applications. A greet varietyof tcchniq u...os ami hardware devices are now in use or under d evelopment forthese d ive rse application areas. In particular, much of today's computer-graphicsresearch is concerned wi th improving the effectiveness. rea lism, and speed of pic-ture genera tion. To p roduce a realistic view of d 11.1tuc.11scene, a graphics programm ust simulate the effects of actual light reflections and refra ctions from physicalobjects. Therefore. the current trend in comp uter graphics is to incorporate im -proved approximations of physics principles into-graphics a lgorithms. to bettersim ulate the complex interactions between objects and a lighting enviro nm ent.

    Features of the Third Editi onThe material in this third edi tion evolved frum no tcs used in

  • systems. tractal geometry. ray tra cing. spline.., illumination models. surface IT'n-dering. computer animation. virtual reality. parallel implementations for graph-ics algorithms, an tialiesing, superquadrics. SSP trees, particle Gill ( over the basic gra phics conce pts and algorithms in thefi rst semester and advanced three-dtmenstonal methods in the second. Fur the

  • ~If-jtuu ~' reader, early cha pters can be used to p rovide an understanding ofgraphics concepts, supplemented with selected topics from the la ter chapters,

    At the underg rad uate level. an introd uctory computer-graphic. cou rse canbe: organized using selec ted m..rteria l from Chapters 2 th rough 6, 11. and 13.Sections could be chosen from these cha p ters to con n two-di mensiona l meth-O\.1s only, or three-dimensional topics could be added from these chapters alongw ith limi ted selections from Chapters. 7 and 10. Other topics. such as fractalrepresen ta tions, spline curves, tex tu re mapping. d epth-buffer methods, or colormodels, cou ld be in t rod uced in a fi~t computer-graphics course. For an intro-d uctory grad uate or upper-level undergrad ua te course, more emphasis could begiven to three-dimensional vie wing, three-dimensional modeling illumin..atlonmodels, and sur face-rendering methods , In genera l, however, a two...semester se-quence provides a Vetter framework for ad eq ua tely covering the fundamenta l.. oftwo-dimensional and th ree-dimensional compute r-graphics methods, includingspline representations, surface rend eri ng. and ray tracing. Special-topics courses.'lith an introductory computer-graphics p rerequisite, can be offered in one Of twoareas, selected from visualiza tion techniques, fracta l geometry, spline methods,ray tracing. radiosity, and computer animation.

    Chapter I illustra tes the di versity of com puter-graph ics applications by tak-ing a look at the mnnv different kinds of pictu res that people have generated w ithgrap hics software. In Chap ter 2, \\'1..' present the basic vocabulary of computergraphics, a long wi th an introduct ion to the hard ware and softwa re componen tsof graphi cs sys tems. a detailed introd uction to OpenGL, and a complete OpenGLexample pmgram. The fund ..amcntel algorithms for the represen ta tion and d is-play of simp le objec ts are given in Chap ters 3 ..and 4. These tw o chap ters examinemethods for prod ucing basic picture components such as polygons and circles:for settin g the color, size. and other a ttributes of objects; and for implementingthese methods in OpenCL Chapter 5 discusses the algorithms for performing ge-ometric transformations such as rotation and scaling .In Chapters band 7, we givedetailed exp lanations of the procedures for displaying views of two-dimensiona land three-dimensional scenes. Methods for genera ting displays of com plex ob-jeers, such as quadric surfaces, splines, fractal", and particle systems are d iscussedin Chapter 8. ln Chapter 9 weexplore the various comp uter-graphics techniquesfor identifying the visible objects in a three-dimensional scene, Illumina tion mod-els and the method s for applying li ghting cond itions to a scene arc exam inedin Chapter 10, Methods for in teractive graphi cs inpu t and for designing graph-leal user interfaces Me given in Chapter 11 . The va r ious color mode ls useful incomp uter graphics are-discussed in Chap ter 12.dong with color-design consider-ations. Computer-animation tech niqu e.. art:' expl ored in Chapter 13. Methods forthe hiera rchica l modeling of complex sY5tem s art> pre-ented in Chapter 14, And.in Chapte r 15, we ::'U f W)' the major graphics file' formats.

    AcknowledgmentsMany people ha ve contributed to this project in a variety of ways over the years.To the organizations and ind ividuals w ho furnished pi ctu res and other materi-als, we again express our apprecia tion. We also acknowledge the many helpfulcomments received from our students in va rious compute r-gruplucs and visual -ization courses and semina rs. \\it' an' indebted to

  • Xli II Preface

    Hedley Bond , DMt Braden. LU

  • Computer Graphicswith OpenGL'--------~- ~

  • A Survey of Computer Graphics

    A saguaro-entertainer scene from a comp uter-generated cartoon animation.(Collflesy of SOFT/MAGE. Inc.)

    2

  • 1-1 C rephs and Cbarts1-2 Computer-Aided lJc!:' i},l11- 3 Yi rtual -Rcalitv Environments1-4 Da til Visualizations1-5 Edm'" linn .111..-1 Training

    1-6 Computer Art1-1 Entertainment1-8 Image Processing1- 9 C raphical User Interfaces

    1-1 0 Summarv

    computcrs have become a powerfu l tool for the rapid and economicalprod uction of pictures . There is vir tually no undertaking in whichgraphical displays cannot be used 10 some advantage, and

  • 4 CHAPTER 1 A SlIm'v of Conundcr Graphics

    FIGURE 1-2 Two-dlrn ensfonalllne gr.lphs, ba rcharts, and a pic cha rt. (Cl1urh'sy of UNIRAS, hIe )

    FIGURE 1-3 Two color-co.Jed data setsdispla yed as a three-dimensional bar chart on thesu rface of a Sl'Ogrilphkal rf'ginn. (R"J'ril1f,'d witII per-nnseion frolll 155CO Grai'lIi.-:" Sail Diego, Ca/{fimril1.)

    FIGURE 1-4 Two three-dimensiona l graphs designed for d rama tic effect. (Reprillte.1witll /It'r mi" i,mfro'll ISSCO Gral'llie:" Stil l D,!rgo, CI1Ufimril1.)

    to sum marlze financial, statistica l, mathematical, scientific, engineering. and eco-n om ic data for research reports . man ageria l summ aries, co nsumer in fo rmationbulletins, and other types of publications . A var iety ofcommercial grap hing peck-ages are available, and wor kstation devices and service bureaus exist for con-verting screen displays into film, slides, or overhead transpa rencies for use inp resenta tions or archiving. Typical ex am ples of d ata plots are line gr aphs, ba rcha rts, pic char ts, surface graphs, con tour plots, and other d isplays showi ng rela-tionships between mu ltiple parameters in two d imensions. three d imensions . orhigher-d imensional sp

  • 1-2 ,

    FIGURE' - 5 Plotting two-dimensionalcontours in a ground plane. with a htd .o;h t fieldplotted asa surface above the ground plane.(Rt'llrilrtl'd willi l't'rmiSSII111 from I$SCO GmpJu(s,5ml Dil'8o, Cil II~fo nl ia . )

    FIGURE 1-6 A lime chart displayingsd wduling and other relevant information aboutprojert t.lskprillh'tt tI-i t/! pmlriss;tm fro m rsscol,fdf!lrics, $ow Dh-go, GJW0rll ill .)

    graphs. Anothcr cxarnple of three-dimensionalgraph ing is " su rface plot, a~ illus-trated in Fig . 1-:;, which shows a height surface and its projected two-dimensionalcontou r p lot.

    Figure 1-6 illustra tes a time chart used in task planning. lime charts and tasknetwork layou ts are 1I~ in project management to schedule and monitor the

    pnl);n~ of projects.

    COMPUTER-AIDED DESIGNA ma jor use of computer gra phi cs is in d esign proccsscs-c-part icularlv for engi-neering and architectu ral systems, a lthough most products an.. now computerdesigned. Generally referred to as CAD, compu ter-a ided design, or CADD,com pu ter-a id ed d rafti ng and desi gn, these methods are now routinely used 111the d esign uf building s,

  • 6 CHAPTE R 1 A SlIn 't'Yof Computer Crap/lies

    FIGURE 1-7 Color-codt'lt,wi re-frame displa y for anautomobile wheel assemb ly.Cc.J" rft.'sy oj E" ,lns ('i Suth!'fltllld,)

    (0)

    FIGURE 1-8 Color-coded, win:..frame ou tlines of body designs for an automobile andan aircra ft. (Courtesy of (a ) Peritek Corporerion .111.1 (b) Erane & Shih/rlllmi.)

    the Jinks be tween components. This allows the designer to quickly test alterna tecircuit schematics for minim iza tion of the num ber of components or the spacerequ ired (or the sys tem.

    Anima tions are often used in CAD applications. Real-time, computer anima-tions using w ire-frame shapes arc useful for quickly testi ng the performance ofa vehicle or system, as demonsrrared in fig. 1-11. Beca use a w ire-fra me Image isnot displayed with rendered surfaces. the calculations for each segment of theanimation can be performed quickly to produce a smooth motion on the screen.Also, wire- frame displays allow the designer to see into the interior of the vehicleend to wa tch the behavior of inner components during motion.

  • 1- 2 7

    FIGURE 1-9 Multiple-win dow, color-coded C/\ D workstation dtsplays . (Callflt'.;:! lJ/lI ' ft't~rllplt Corpomtion.v

    FIGURE 1-10 A circuit des ignapplication, usingmultiple wind ows and color-coded logic components.(CoJj rfl'sy of SUit .'I-ficrtlsyMOIl S.)

    FIGURE 1-11 Simulation lIf vehicle pe rformanceduring lane chongcs, (CllI jrti'S,1I ofE l'tlll, C-" 5Illh,dill1.i andll'1cd /imicnl Dynlliliifs, [ IIC. )

    When object d esigns arc complete, or nearly complete, realistic ligh ting con-d ition.. and surface rendering are applied to p rod uce d isplays that w ill show theap pl'ManCf' o f the final prod uct. Examples o f th is art' g i\'f'O in Fig. 1-12. Realis-tic displays (Fi!:?i. 1-13).

    The manu facturing process is also tied in to the compu ter description ofdesigned objects so that the fabrication of a product can be automated, usingmethod s that MC referred to as CAM, computer-aided manu facturing . A circuit

  • 8 CHAPTER 1

    (. ) ( t> )FIGURE 1-12 RC

  • 1-2 CVII/plIler-Aided Design 9

    :: ~iS'L'-,

    ,.

    ~._--> -~ .,~~-"';------ - - -

    --

    {'I

    ". "'..

    ,..

    '."'.""l1f " .."..~,." .", .. .-

    - -

    FIGURE 1-15Architectural CAD [avriu t fora build ing design . (Co r/r't'~y offl,ecisioll Vi5uals, " Ie., Bouldcr,Cvltlwdo.)

    Ihl

    FIGURE 1-1 6 Realistic, three-dimensional renderings of bu ilding designs. (a) Astreet-level perspective for the World Trade Center project (COl' rtesy ofSkid'llOre, (}'[>illg~,& Merrill.) (h) Architectura l visuahzanon of an atrium, created for a cOlllpllkr animationby Marialine Prieu r, l yon, France. (Coarlt'sy l~r Tho/lf5l.m Digilill TlI/lIgt', ble.)

    arra ngements for wm ng, electrical outlets, and fi re-warning systems. Also,fcctlity-Iayout packages can be used to optimize space utilization in an officeVI within a manufacturing facility.

    Realistic d isplays of archi tectural designs. as in Fig. 116, permit both archi-tects and their clients to stu dy the appearance of a single build ing or a grou pof buildings, such as a camp us or ind ustrial complex. In ad dition to realistic ex-tcrior build ing displays. architect ural CAD packages also provide facilities forexperimenting w ith three-dimensiona l interior layouts and lighting (Fig. 1-17).

    Many other kinds of systems and prod ucts arc designed us ing either generalCAD packages or specially developed CAD softwa re. Figure 1-18, for exam ple,shows d rug pa ttern designed ,...ith " CAD system.

  • '0 CHAPTE R 1 /I. SlIn 1t'Y (If Computer Gmpbics

    FIGURE 1-17 A hotel corridor that prov ides aSC!1Sl:' o f movement by position ing ligh t fixturesalong an und ulating pa th and creates a Sl."Il~C llf.'ntry hy placing a Hght tower at thr en tra nce toeach room. (eliUr/n,1I of SkidtiM'C.', Oll'lIIg~ . & M('rrilI. )

    FIGURE 1-18 Orien tal rug pattern cre-ated withcomputer-graph ics design methods. (Cmlrle~y of u-xid" taCorporntioll.)

    VIRTUAL-REALITY ENVIRONMENTS

    FIGURF 1 19 Operating atractor in a vlrtua l-realitvenvironment. Ih the controlsart' moved, the operatorviews the fron t loader,backhoe, and surroundingsthrough \:he headset. (Collrtl'S!:!{oj till' Natiml1l1Center for5"11t'n:omp til ill~ Ap/l/imt;olts,l/lt il't7Sity of lIIi1wis atIIr/Itl '11l-CllIlml'rligu, MidCilirrpillar, 11K,)

    A more recent applica tion of com pu ter g raphics is in the creation of virtua l-realityenvironments in which a user can interact w ith the objects in a three-d imensionalscene . Spcclalizcd hardware devices provide three-dimensional view ing effec tsand allovv the user to "pick up" objects in a scene.

    Animations in virtual- reality environmen ts are often used to tra in heavy.equipment opera tors or to analyze the effectiveness of various cabin configura.lions and con tro l placements, As the tractor opera lor in Fig. 1-19 mani pulates the

  • 1-3 Virtual-Rcalitl/ Enriromncnts"

    FIGURE 1-20 A headset view of the backhoepresented to a tractor operator In a virtual-realityenvironment. (CllW"ft'~y (If the NI/hu1II,I Censerfi"SlIlleroml/llIti ,jg ApplialfiiJlIs, U"it'O, ity of fII illais lItU rl\ll1a-(bamJ'fI(>:Jl , and Catt'fpi!ln f, 1m: .)

    FIGURE 1-21 Operator's view of the tractorbucket. compos ucd in several sections to form

  • 12 CHAPTER 1

    DATA VISUALIZATIONSProd ucing graphical representations for scient ific, engineering, and medical datasets and proc('SS('s is another fa irly new application of comp uter graphics,which is generally referred to as scientific visuali zation. And the term businessvisualiza tion is used in connection with da ta sets rela ted. to com me rce, ind ustry,and other nonscientific a reas.

    Res earchers, analysts; and others often need to deal with large amounts ofinformation or to study the behavior uf highly comp lex processes. Nume rica lcampu tet sirnula nons, tor example. frequently produce data files containin g thou-san ds and even mi llions of values. Similarly, satellite cameras and othe r recordingsources a re amassing large data files faster than they can be interp reted. Scanningthese large sets of numbers to determine trends and rela tionships is .1 ted iousand ineffective process. But if the da ta Me converted to a " iSH.11form. the trendsand patterns are often immed iately appa rent. Figure 1-23 shows an example of alarge da ta set that has been converted to a color-coded di splay of rela tive heigh tsabove a ground plane. Once we have plotted the density values in th is wa}'. wecan easily see the ov erall pattern of the data.

    There arc ma ny d ifferent kinds uf data se ts, and e ffective visualiza tionschemes depend on the characteristic s of the data . A collection of da ta can con-tain scalar val ues, vec tors, h igher-order tensors, or any combina tion of these datatypes. And data sets can be d istrib uted over a two-d imensiona l region of space.1 three-d imensional reg ion. or a higher-dimens iona l spa ce. Color coding is justone way to visualize a data set. Other visualization tech niques include contourplots. renderings for cons tan t-val ue surfaces o r othe r spatial regions.and speciallydesigned shapes tha t Me used to represent di fferent data types.

    v isual techniques are also used to a id in the unde rs tand ing and analysisof complex p roc esses and ma thematical functions. A co lor plot of mathematicalcurve functions is show n in Fig. 1-2-4-, and a surface plot of a function is sho wnin Fig. 1- 2..~ . Fracta l proced ures using qua temions generated the object shown inFig. 1 26, and a topological structure is d isplayed in Fig. 1-27. Scien tists are a lso

    FIGURE 1-23 A colo r-coded plo t WIth sixteenmill ion density points of relative brightnessobserved for the whirlpool Nebula reveals twndis tinct gala xies. (CO/lr1(~y of L...,. A /11Im...,. ....'llriO/IIII

    Ul~mlfory. )

    FIGURE 1-24 Mathematical curvefunctions plotted in various colorcombinations. (COl/rles.1I (ifMelt-ill L. Pnll'ill .Lt.);'; Alrmitl~ Niltiomll Laboratory.)

  • 1-4

    FIGURE 1-25 u gh tingeffects and surface-renderi ngtechniques were applied toproduce this surfacercp n.':>l:lll.,tillll fo rathn...-dunen..tonal function.(COllrfc'Sy of Woifralll 8:;c.arclT.Inc.. Tilt' Mo1kRr of....1atllrmatiCll ,)

    13

    FIGURE 1-26 A four-dimensional objectprojected into three-dimensiona l space, thenprojected to the two-dimensional screen of a videomonitor and color coded. The ol>j.x1 ..",a", genera tedusing quatemiore, and (r

  • 14 CHAPTER 1

    FIGURE 1-28 A me thod fur grilphi.ng andmodeli ng data dis tributed over a sphencat surface.(Co!l r k'sy o! C fI.'8 N i('/sOIl , Connmter ScienceDepartment, A r iU1lw Stllte Ull f

  • AGURE 1-31 Numericalrnodclof the surface of "th und ersto rm. (Co ll rrj'~!1 ofB"/l lVilhelm,ml, D ,'par-{II I,' l rt IlfAtmosplleric Sciences and lilt'N,7Iiolla[ Ceurer l IJ I"51 ipcrcomputing Applicil tr(J! I~ .Ulfizw sity ofWI/WIS litUrbrma-Cl/llmptlis " )

    1- 4 Data Vi~llllliz afiolls 15

    FIGURE 1-32Color-cod ed visualiza tion ofstress

  • 16 CHAPTH 1 A Sum:,!! vf Computer Grnpli ics

    FIGURE 1-34 Commercialsliccr-diccr software, showingcolor-coded data values overcross-sectiona l slices o f a d ataset. (Courtesy of St'Yglass, file)

    FIGU RE 1-35 Visualizationo f a p rotem struc ture, created byJar Siegel and Kim Ba ld ridge,SDSC. (Corlf trsy oj S/cphal1 il'Sides, Stlrt DieXo SllptTCOmpllterCf'lI fer.)

    FIGURE 1-36 A scien tistin teracting w ith stcrcoscoptcviews of molecu lar structureswithin a vi rtual-realityenvironment called the "CAVE".(Courtesy of William Sturman andtlle Natiollal Ceuter forSupt'ffompll tillg Apl'lical ;OIls,Unii.'Crsil.1I of Illinois atUrball.1-ellampaigll .)

  • AGURE 1-37 One image from a stereoscopic pair, showing avisualization of the ocean floor obtained from satellite d ata , ere..ated bvDavid Sandwell and Chris Sma ll, Scripps Institution of Ckt'anograph~', andJim Mcleod. SDSC. (CC'flr rlOSy of Str"J/lmif' Si.tt'":>. Sail Diet l) S,,:v rCl''II f1llt"em /cr.)

    FIGURE 1-38 A sim ulation of the effects of the 1991 Kuwaiti oil fires.developed b}" Gary GI.1Izmeier. Chuck Hanson, and Paul Hinker. (Cllllrfes.1(of Mike Krogh, A b ollu.1 Compllri"g L1flor.1flJry at the u.t5 AllUmI'> .''Iiulilll llilLl bom /lJry.)

    1-4 17

  • I. CHAPTER 1 A SlI rt1l.'Y ojCtlllI/'IIft' r Gmpil ir~

    FIGURE 1-39 Avisualization of pollu tionove r the earth's surface,devised by Tom Palmer, CroyResearch Inc./ :-Jese,ChrisLandreth, NCSC. and DaveBock, !':CSC. Po llutan t SO.. isplotted .1S .a blue su rfar-e,acid-rain deposition is a co lorplane nn tbe map surface, andrain concentra tion is shown ilSd ea r cylinders. (Cllllrtesy of tileNort h CilW!i ,1

  • EDUCATION AND TRAINING

    [ aHcatiOll alld Tmini/ Ig 19

    Computer-generated mod els of physical, fi na ncia l, political, social. economic,and other sys tems Me often used as ed ucational aids. Models of physical pro-cesses, physiological functions, po pu la tion trend s, or equipment, such as thecolor-coded d iagram in Fig. l .B, can help trainees to understand the opera tion ofasystem .

    For some tra ining ap plications.special ha rdwa re systems are designed. Exam-ples ofs uch spec ialized ..ystems a rt.' the simu lators for pract ice sessions or trainingof sh ip cap ta ins, ai rcra ft p ilo ts. heavy-equipmen t opt>rators, and ai r Ira Hie-con trolpersonnel. Some simulators have no video screens: for example, a flight simula-lor with on ly a control panel for instrumen t fl yin g. But most simulators providescreens for visual displays of the externa l envi ronment. Two examples of largesimulators with internal viewing systems are shown in Figs, 1--1 -1 and 1--15. An-other type ofviewing system is shown in Fig. 1-46(b) and (c). Here a viewing screenwith mult iple panels is mounted in front of the simulator, and color projectorsd isplay the fl ight scene on Ih..~ screen panels. Figure 1--17 shows the instructor 'sarea thai can be situated behind the cockpit of .1 fligh t s imu lator. The keyboardis used by the Instructor to input parameters affec ting the ai rplane performanceor the environment. and the path of the aircraft and other data is viewed on themonitors d uring a tra ining or testing session.

    Scenes generated for aircraft. naval . and spacecraft simulators are shownin Fi~ . 1-48 thro ugh 1-50. An automobile simulator and associated imagery isgiven in Fig. I-51. Part (a) of th is figure shows the interior of the simulator andthe view ing screen visible through the windshield . A typ ical traffic street scene isshow n in Fig. I -51 (b). Although automobile simulators can be used as trainingsystems. they arc commonly employed to study th..' bchavior of d rivers in criticalsituations. Driver reactions in various traffic conditions can then used as .1 basisfor op timizing vehicle design to maximize traffic safety.

    FIGURE 1-43 Color-cod ed d iagram used 1(1 explainthe operation of .1 nuclear reactor. (Collrtesy of UJS Alamtls.'Jufim/lll Lll b.ml fory.)

  • 20 CHA PTER 1 A SlI rvey of COlllputer Graplllcs

    -

    .tilfflA;hl sim ulator witha full-color visu al system an d c;ix degrees of freedom inits motion. (COljrltosy of Fra~a l/I I,rna tit'llul.)

    FIGURE 1-45 A military tank sunula tor with a visual imagery system. (Courtesy oflv"'diiltffh cud GE At'ro~'1ilt't".)

  • 1-5 Education end Treining"

    (0 ,

    (c)

    (0)

    -

    FIGURE 1-46 The cabin m terior (

  • 22 CH APTER 1

    FIGURE 1-48

    FIGURE 1-49 Imagerygenerated for a navalsimulator (C(,lIrlt>'.1I (IfEt"m~& Sutller/ml,t )

    . .

    FIGURE 1-50 Space-shuttleimagery, (CCl/J rt("5!1 (IfM1,1iatcct,mIl GEA['fl>:>~'l'C!'. )

    , r

  • 1-6 Compute Art 23

    (a I

    :;,'

    (bl

    FIGURE 1-51 The interior of an au tomobile-s imulator (a) and

  • 24 CHA PTER 1

    {. j {h I

    flGURE 1-53 Ca rtoon demonstrations of

  • -.

    ----

    1-6 Connnuer A rt 25

    FIGURE 1-55 An.electronic watercolo r. pa intedby John Derry of Time .A, rt-;,Inc. using a cord It'S:>.pressure-sen si tive ..tylue andLumena gouache-brushsoftware. (COlirle$!! of WacvmT,;dmoto}i,!I CcrptJratioll. )

    FIGURE 1-56 The artist oithis picture, entitled ElectronicA:,'al,11lclll', makes d sta tementabout our entanglement withtec hnology, using a personalw mpu leT with a graphicstablet and Lumena softwa re10 combine renderings oflea ves, flowe r pd.ll!'o, andelec tronics components withscan ned images. (Ccurtf'$!/ of" ll Wil!i.l"l ~ G,11!tTy. 199110011 Tr uccevcrod, TIlt' Sd w f ~(th.'A,! I1rsti futl." oj Clricago.)

    Fine artists use a va riety of other computer technologies to p rod uce images. Tocreate pictu res such as the one shown in Fig. 157. the artist U~f'S a combination ufth ree-d imensional modeling packages, texture mapping. d rawing programs, andCA D software. In Fig. 1-58, we have d painting produced on a p

  • 26 CHAP TER 1

    FIGURE 1-57 From aseries called "Sphere-s (IfInfluence", this ekc trorucpain ting (entitled

    WlI(~ 'lIalll rt't') WdS crea ted\\ ith d combi na tion ofmethods using a graphicsta blet, three-dlmensionalmod..ling.. texture mapping.and a sene, ( If geometrictransformations. (COljr tl'~Y of11,.' W/lJimll s G.71!('rl/. :&1 1992

    ~V"ml (' Rag/mrd. I r.)

    FIGURE 1-58 Eh..ctroruca rt nu lr Ul lO a f'l'll plotterfrom ~Iilwarc speciallydesigned bv the artist toemula te his style. The pp

  • 1-6 CI1II:prd," Art"

    I:IGURE 1-60 Using mathematical functions,fractal procedures . .md supercomputers, thisartist-composer expe riments with various d esignsto svuthesize form and color wi th musicalcomposition. (Collrlc,y of Brill " El~m~ , Vmh1l'rbiltU/I itl('r51'y. )

    RGURE 1-61 Page-la yout workstation. (Coll rttwof\-'isIlO[ Tcdfl:tJlogy.)

    FIGURE 1-62Three-dimensional renderingfor a logo, (Coll rlc~y Ilf VI'r/igoTcc}lIw/o1',OY, /11[, )

    As in many other com p uter-graphics applications. commercial-art d isplaysoften employ pho to-realistic techniques to render im ages of .1 desi gn, p roduct.or scene. Figure 1-62 shows an example of three -d imen sio nallogo design, andFig. 1-63 gives three computer-g raphics images for p roduct advertising.

    Computer-generated animations arc a lso frequently u sed in producing tele-vision commercia ls. These ad vertis ing spots a rc generated frame by frame, whereeach frame of the motion is rendered and saved as a sepa ra te Image file. In eachsuccessive frame, object positions are d isplaced slightly to simulate the motionsinvolved in the ani mation. When all frames in the animation ::;eq ucnce have beenrendered . the frames aft" transferred to film orstored b a video b uffer for playback.Film anima tion.. require 2~ frames tor each second in the animation sequence. Itth e anima tion i.. to be p layed back on a video monitor, a t least 30 fra mes persecond are requ ired.

    A common graphics method employed in many television commercia ls islIlorpllillg, w here one objec t is transformed (metamorphosed ) into another, Thi smethod has bee n used in TV commercia ls to turn an oil can into an automobile

  • sa CHAPTER 1 A Sllm :-y afComputer Gmp.'lics

    (,) (b) (c)

    FIGURE 1-63 Prod uct advertising using computer-generated images. (Courtesy of(a) Aud rey Fleisher ond (b) mId (c) SOFTIAtAGE, II/c.)

    eng ine. an a utomobile in to a tiger. it p udd le of wa ter in to a tire, and one per-son 's fa ce into another face. An examp le of morphing is gtvcn in the next section(Fig . 1-69 ).

    ENTERTAINMENT

    FIGURE 1-64 A graph ic!>scene from the TV series D,'epSpace NiIIC. (Collr tc:;y 14Rhlltflm & Hut's Stlldios.)

    Television productions, motion pictures , and music videos rout inely usccomputer-graphics methods. Sometimes graphics image.. are combined withlive actors and scenes, and sometimes the fi lms arc completely generated usingcompu ter-rendering and animation techniques.

    Many TV series regularly em ploy com puter-graphics methods to prod ucespecial effects . such as the scene in Figure 1-64 from the television series DeepSpace Nine. Some television programs also use animation techniques to combinecomp uter-genera ted figu res of people,animals. or cartoon ch aracters w ith the Ii veactors in a scene or to transform an actor 's face into another shape. And many pro-gra ms employ compuler graphics to generate build ings, terra in fea tures, or otherbackgrounds for a scene. Figu re 1-65, shows a highly realistic computer-genera tedview of thirteen th-century Dad u (now Beijing) for a Japanese television broadcast.

  • , -7 Ent(7't rl lll/m 'l1f 29

    FIGURE' -65 An image from ,1clIlllp ull'r-gcnerilk d reconst ruction ofthirteenth-century Dadu (Beijing today), crea tedfor a Japanese broadcast by Ta isei Corporation(Tokyo. Japan ) and rend ered with TOr ~lft ware .(COlir l rs.II of TII(III1 ~O I1 Visifal /mllgf, l ilt'.)

    (.,

    FIGURE 1-GG Graphics developed forthe Paramount Pictu res movie StllrT"-k-Th( ~,\Imth of Khan. {COIlTtI'SY (~rEm lls & Sll t/wrltl ll.I.)

    (bJ

    FIGURE t -67 Co mputer-gene ra ted film scenes; (a ) Red '$ Drtrlll/, (Collrt6 .11 of Pixar:Copyrigh t :Q Pixar 1987.). and (b) Kuickklltlck, (C(llrrtt'sytlf Pixil r. Copyrigh t @ Pixar 1989.)

    Compu ter-generated special effects, animations, characters, and scenes arewidely use d in toda ys motion pictu res . Figure 1-66 illustrates a preliminarycomputer-graph ics scene genera ted for the movie Star Trck-T1Jt' Wrath of Khan.Rendering method s are then applied to the wire-frame forms for the planet andspuo..-ship in this illustration to prod ucc the final surface appearances (If the objectsthat arc shown in the film. Advanced computer-modeling and surface-renderingmethods were employed in two award-winning sh or t films to p roduce the scenesshown in Fig. 167.Other fi lms employ computer modeling. rendering, and anima-tion to prod uct' an en tire human-like (".1 S t of cha racters. Photo-realis tic techniquesarc employed. in su ch films to gin the computer-generated "actors" fl esh tunes,

  • 30 CHAPTE R 1

    FIGURE 1-68 A o;('t>Oefrom the film Final FQnta~}I '17lt' Spirir~ l\';~hill ..howin~three of the anima tedcha racters in the cast: Or. AkiRoss, Gr., v Ed wards. andDr. Sid (Cl,urf>:>y of S'll/arl'

    Picllm~. IIIC- 'il 200J rrFl~ Allr iS!IIs'l'St.'Tn,'.I.)

    "1 [h , ,

    n h:)

    FIGURE 1-69 Examples of Tllt.rphlll); from the David B}me \"idt'u Slu."s .\ i,ld.(Collrl~1I (Jf Dat'iJ Bl/mr. I.J.lI'.l \!I,fl~). mri PaC/fil: Vala Ima\'t~ .)

    .' - . ..

    real istic facial fea tures. and skin imperfections such uS moles, sunspots, freck-les, and acne. Figure 1-68 shows a scene frum the film Final Falltasy- I1I (' S/,irig\'\'i111;/I , which em ployed these photo-realistic techniques to closely s imulate thedp pearance of a cast of h uman actors.

    Computer-gra phics method ..ca n also beempl oycd to sim ulate a huma n actor,Using digital files of an actor 's facial featu res. an animation p rogram can gencr~ate film ~quence~ tha i contain .1 computer-generated replica of that person. InIhL' event of an illness or accident d uring the film ing of a motion pictu re. these..imula tion methods CUll be used to replace the actor ill subsequent fi lm scent'S.

  • 1-8

    Music videos use compu ter graphics in several ways. Craph ics objec ts ca nhe comb ined with the live action. Of graphics and image-processing techniquescan be used to p roduce a transformation of one pt.rson or object into another(morphing). An examp le of rnorphing is given in the S'\.l uence of scenes inFig. 169, produced fur the David Byrne video 511,,'.; .\-In.!.

    )1

    IMAGE PROCESSINGTIll' modification or interpreta tion of existing pictures, such as photographs andTV scans, is called im age proces sing. Although methods used in comp uter graph-icsand image processing overlap, the two arcas arc concerned with fund amentallydi fferen t operations. In comp uter graphics, a comp u ter is used to crea te a picture.Image-p rocessing tcchniqu...~. on till' other hand, are used to impro ve p icturequality, analyze images, or rec ognize visual patterns for robotics applica tions.However, image-processing methods are often used in computer graphics. andcomputer-graphics methods are frequently ap pl ied in image proces sing.

    Typically. a photograph or other p icture is llij:;; il iLI.d into an image file beforeimage-p rocessing method." are employed . Then di gital methods can be used ton:arr.1nge pictu re parts, to enhance color separa tions, or to improve the quality ofsha di ng . An example of the ap plica tion of image-p rocessing methods to enhancethe quality ofa picture is shown in Fig. 1-70.These techn iques are used extensivelyin commercial-ar t appli ca tions that involve the retouching and rearranging ofsections of photogra phs and ether artwork. Similar methods arc used to analyzcsa tellite photos of the earth and telescopic recordings of galactic star di st ributions.

    Medical appllcarions also make extensive usc of Image-proces sing tech-niqucs for picture enhancements in tomography and in s imulations of surgicalopera tions. Tomogra phy is a technique of X-ray photography tha t a llows cross-s A1il I1U~NIJ!lmlll i LAroriJ!t' ry.)

  • 32 CHAPTER 1 A Survt'Y of Computer Gmpfl ics

    FIGURE 1-71 One frame fmm a comp uteran imation visualizing cardiac activa tion levels withinregions of a semitransparent volume-rendered dogheart. Med ical da ta furn ished by William Smith,Ed Simpson, and G. Allan johnson, Duke- Universi ty,Image-rendering software provided by Tom Palmer,Cray Research, Inc./ NCSC. (Collrrtsy of Dm't' Bock,North Carolina Sli percomputillgCclltcr/MCNC. )

    FIGURE 1-72 One image from a stereoscopicpa ir, showing the bones of a human hand. renderedby Inmo 'ro on. D. E. Thompson, and W. N.w aggenspack, [r., LSU, from a da ta set obtained withcr scans by Rehabilita tion Research, GW LNHOC.These images show a possible tend on pa th forreconstructive surgery. (C(lfj rtcs.v of IMRLAB,Mecil.11 Iica/ E,rgillt't' riug, Louisiana State Ull i/.'t'r$ity.)

    d uring sur~cry. Other medical imu",ing techn iques include ultrasonics und nu-clear medicine scanners. With ultrasonics, high-frequency sound wav es are usedins tead of x -rays to generate d igital data. Nuclear med ici ne scanners collect dig-ital da ta from radia tion that is emitted by ingested radionuclides, and the da ta isthen p lotted as color-coded images.

    Image processing and com puter graphics are often combined in med ical ap-p lications to rnodel and study physical functions, to design artiflciallimbs. and toplan and practice surgery. The last ap plication is generally referred to as COlllpli ter-nide,#surgery.Two-dimens ional cross sections of the body are obtai ned using im ag-ing techniques. Then the slices are viewed and manipulated using graphics meth-ods to simulate actual surgical procedures and to try out di fferent surgical cuts.Exam ples of Ihe-sc medical applications arc shown in Figs. 1-71 and 1-72.

    GRAPHICAL USER INTERFACESIt is common now for applications software lo provide a graphical user interface(GL1 ). A major component of a graphical interface is a window manager thatallows a user to disp lay mul tiple, rectangu lar screen areas, called displa y \....in-dows. Each screen disp lay area can con tain a different process, showing graphicalor nongraphical in forma tion, and various methods can De used to activate a dis-play window. Using an I nteractive pointing device,such as

  • -,..,.-,

    .,- -

    FIGURE 1-73 A graphicaluser interface, sbowingmultiple d isp lay windows,men us. and icons. (C()l~ r!t"'iy ofl",ng.'-ln G'rporntkm.)

    Interfaces also d isp lay menus and icons for selection of a d isplay w indow,a processing opt ion, or a parame ter value. An icon is d g raphical symbol that isoften designed 10 ~uggest the option it represents. The ad vantages of icons arethat they take tip le5s screen space than correspo nd in g textua l descriptions andthey can he underst ood more quickly if well d esigned . A d isplay w indow canoften be conve rted to or from an icon rep resentation, and menus can con tain listsof both textual d escrip tions and icons.

    fi gure 1-73 illu strates J typical gra phical interface, containing multiple d is-p lay window:" menus, and icons . In this exam ple, the menus allow selection ofprocessing op tions, color values , and graphic" parameters. The icons n..-prcscntoptions for painting, drawing. zooming, typing text strings, and other opera tionsconnected with picture construction .

    Rojerm us J 3

    1-10 SUMMARY

    We han" surveyed m

  • Overview of Graphics Systems

    A wide, curved-screen, computer-graphics presentation system and lte control desk.(Cot."lesy 0.1 Silicon GraphiCs, Inc. ana Trimens:On Systems. .;; 2003 SGt, All flgms reserved.)

  • 2- 1 Video Display Devices2- 2 Raster-Sca n Systems2-3 Graphics \,Vllrk5ti1tioIl5and Vitwing

    Systems2- 4 Input Dovico-,2-5 Hard-Copy Devices

    26 Graphics Networks2-7 Graphics on the Internet2 -8 Graphics Softwa re2-9 Introduction tu OpenGL

    2-10 Summarv

    The power and u tility ofcomputer graphics is widely recognized, and,1 broa d range of graphics hardware and software systems arc nowavailable for applications in virtu ally all fields. Graphics capab ilitiesfor both two-d imensiona l and three-d imensional ap plications arenow com mon, even on general-p urpose compu ters and handheld

    calculators. w ith persona l comp uters, we can use a variety of interactive inpu tdevices and graphics softwa re packages. For higher-quality app lications, we canchoose from a n um ber of sophisticated special-purpose graphi cs h ardware sys -tem s and technologies. In th is chap ter, \':C exp lore the basic fea tures of graphicshardware components and gra ph ics software packages .

    VIDEO DISPLAY DEVICESTypically the primary output d evice in a graphics sys tem is a vid eo mo nitor(Fig. 2-1). The operation of most video monitors is bas,.xl on the standardcath ode-ray tu be (CRT) design, bu t several other technol ogies exist and so lid --tate monitors may eventually predom inate.

    FIGURE 2-1 A compu ter-graphics workstati on.(Cmjrfl'~ IIofSilicon GmJlllies. IIIC , Willi N(II Fil /JIS, and

    . .

    525 H'~ t Pm tuctitm. 2OU3 SCI. All riSitts reser

  • 36 CHAPTER 2 Ol't'n'inv Of Graphics 5ysft'ms

    Refresh Cathode-Ray TubesFigure 2-2 illustrates the basic operation of a CRT. A bea m of electrons (comoderays), emitted by an electron gu n, passes through focusing and deflection systemsthat di rec t the beam toward specified pos itions on the phosphor-coated screen.The phosphor then emits a small spot of light at each pmi1t ion con tacted by theelectron beam. Because the light emi tted by the phosphor fades "cry rapidly,some method is needed for maintain ing the screen pic ture. One way to do thisis to s tore the picture in formation as a charge d istribution with in the CRT. Thischarge distribution can then be used to keep the phosphors activa ted . However,the most common meth od now employed for maintaining phosph or glow is tore-d raw the picture repeatedly by quickly directing the electron beam back over thesame screen points. This. type of d isplay is. called a refresh CRT, and the freq uencyat which a picture is redrawn on the screen is referred to as the refresh rate.

    The primary components of an electron gun in a CRT are the heated metalcathode and a control grid (Fig. 2-3). Heat is supplied to the cathode by d irectinga current th rough a coil of wire, called the filament, inside the cylind rical cathodestructure, This causes electrons to be "boiled off" the hot cathode surface. Inthe vacu um inside the CRT envelope. the free. negatively charged electrons arethen accelera ted toward the phosphor coating by a high positive voltage. Theaccelerating voltage can be genera ted with a positively charged metal co.ntingon the inside of the CRT envelope near the p hosphor screen, or an acceleratinganode, as in Fig, 2-3, can be used to p rovide the positive vo ltage. Sometimes theelectron gun is designed so tha t the accelerating anode and focusing system arewithin the same uni t.

    MagneticDe flection Cons

    Focusing ISystem

    \

    Phosphor-,~- Coated

    S CH'Cn

    FIGURE 2-2 Basic design01a m agnetic-defl ect ion CRT.

    ConnectorPins

    EI..ctronGun

    ElectronBe am

    FIGURE 2-3 Operation ofan electron gu n with anaccelerettng anode.

    Cathnuc

    I

    Heaung /'Filament

    ICon tro l

    G rid

    FocusingAlI(K.h:

    IAccele ra IIII g.

    A node

    ElectronBeamPath

  • 2-1

    Intens ity of the electron beam h. controlled by the vol tage .11 t l~ control grid,which is d metal cylind er tha t fils over the ca thode. A high negative voltage ap -plied to the control grid will shut off the beam by repelling electrons and stopp ingthem from p assing through the small hole at the end of the control-grid structure .A smaller negative voltage on the control grid sim ply dec reases the number ofelectrons passing thro ugh . Slnce the amoun t of light emi tted by the phosphorcoa ting depends on th e n umber of electrons s triking the screen, the brightnessof a d isplay poin t is controlled by varying the voltage on the control grid. Thisbrigh tness, or intensity level, is spec ified for individual screen positions wi thgraphics software c..omm..mds. os discussed. in Cha pter 3.

    The focusing system in a CRT foro..-s the electron beam 10 ("(lnverge to a smallcross section

  • 38 CHAPTER 2

    Phosphor-CnntcdScreen

    EI"clmnBeam

    VerticalDeflection

    Pla tes,

    H"ri~(llll ;'~' ~~~~::"""""""""':CDeflectio n

    Plat es

    r r

    FocusingSy,tcm

    ElectronG U ll

    Ba~c

    /Con nector

    PinsFIGURE 2-4 Elec trostaticdefl ection of IIw electronbeam in ,1 CRT.

    FIGURE 2- 5 Intensityd istribu tion of an illum inatedpho....phnr spot on a CRTscreen.

    FIGURE 2-6 Twoilluminated phosphor spotsare distinguishable whenthe ir separation is greaterlimn the diameter il l whicha spot intensity ' ''IS fall en 1060 percent of maxim um

    the electron ligh t emissions : a glowing spo t that quickly fades a tter a II the excitedphosphor elec trons have re turned to their ground ene rgy level. The frequency (orcolor) of the light emitted by the phosphor is proportiona l to the energy differencebetween the excited quan tu m sta te and the grou nd sta te.

    Diffe rent kinds of phosphors are available for use in CRTs. Besides color,a major d ifference between p hosphors is their persisten ce: how long they con-tinue to emil light (tha t is, how long before all excited electrons have returnedto the ground state) after the CRT beam is removed . Persistence is defi ned asthe time that it takes the emitt ed light from the screen to decay to one-ten th ofits original in tensity. Lower-persistence phosphors req uire h igher refresh rates tomain tain a picture on the scree n without flicker. A phosphor with 10\": persis tencecan be useful for animation, while high-persistence phosphors arc better sui tedfor dis playing h ighly complex. static pictures. Although some phosphors han!persistence val ues greater tha n 1 second, general-p urpose graphics monitors an:usually constructed with pe rsistence in the range from 10 to 60 microseconds.

    Figure 2-5 shows the in tensity distribu tion of a spot on the screen. The in-tensity is greatest at the center of the spo t, and it dec reases with a Ga ussiand istrib ution out to the edges of the spot. This d ist ribution corresponds to thecross-sectional electron density d istribution of the CRT beam.

    The maximum n umber of points that can be d isplayed without ove rlap on aCRT is referred to as the reso lu tion . A more precise definition of resolution is thenumber of points per cen timeter that can be p lotted horizontally and vertically,although it is often simply sta ted as the total number of points in each di rection .Spot intensi ty has A Ga ussian d istribu tion (Fig. 2-5), so h ....-o adjacen t spots willappear d istinct a s long as their separation is greate r than the d iameter at w hicheach spot has an intensity ofabout no percent of that at the center of the spot. Thisoverlap position is illus tra ted in Fig. 2-6. Spot size also depends on intensi ty. Asm ort' electrons are accelera ted toward the p hosphor per second. the dia me tersof the CRT beam an d the> illum inat ed spot increase. In add ition. the increasedexcitation energy tends to spread to neighboring phosphor atoms not d irectly inthe pa th of the beam, which further increa ses the spot diameter. Thus. resolutionof a CRT is depend ent on the type of phosphor, the intensity to be d isplayed, andthe focusing and defl ection sys tems. Typical resolu tion on h igh-quality systems is1280 by 1024, w ith higher resolu tions available on mun y sys tems. Hi gh-resolu tionsystems are often referred to as Ili..~ll-tft'fi" i t ioll ~yMt'm s. TIle physical size ofa graph-ics monitor, on the other hand. is given as the length of the screen diagonal, \v ithsizes varying from abou t 12 inches to 27 inches or more. A CRT monito r can beattached to a va riety of computer systems. so the n umber of screen points thatcan actual ly be plotted also depends on the capabili ties of the system to which itis attached .

  • 2-1

    Raster-Scan DisplaysThe most common type of graphics monitor employing a CRT is the raste r-scandisplay, based on television technology. In a raster-scan system, the electron beami:. swep t across the scree n, om" (0\"- .1 1 a time. from top to bottom. Each row isrefe rred to as a scan line. A.. the electron beam moves across a scan line. thebeam lnt ensitv is tu rned on and off (or set to some intermed ia te value) to create a

    pattern of illuminated spots. Picture definition is stored in a memory area calledthe refres h buffer or frame buffer, where the term frame refers tu th... tot.a1screenarea . Th is memory area hold .. the 5c1" of color values for Ott: screen points. Thesestored color values are then retr ieved from the refresh b uffer and used to cont rolthe intensi ty of the electron beam as it moves from spo t to spot across the screen.In this way, the picture is "pain ted" un the screen one scan line at a time, asdemonstrated in Fig. 2-7. Each screen spot tha t can tIL' illumina ted by the elec tronbeam is referred to asa p ixel or pel (shortened forms of p ictu re elemen t). Since therefresh buffer is used to store the set of screen color values, it is a lso sometimescalled il color buffe r. Also, othc-r kinds of pixel informa tion, besides color. arestored in buffer locations, so nll thc di fferent buffer areas are sometimes referredto collective...ly as the "fra me b uffe r". The capability of a raster-scan system tostore color information for each screen point makes it \\If'1I su ited for the realisticd isplay of SI.."eI1CS containing subtle shad ing and color patterns. Home televisionsets and p rinters are examples of other systems using raster-scan methods.

    Raster system.. are commonly characterized by their n ..s olution . which is thenu mber of p ixel positions thatean be plotted. Another property of video monitorsj .:; as pect ratio, which is now often defined as the number of pixel columns di videdby the num ber of scan lines that can be di splayed by the system. (Sometimes thererrn aspect ratio is used to refer to the n umber of scan lines d ivided by the n umberof pixel columns.) Aspect ra tio can also be- desc ribed ,1'; the number of horizonta l

    Vi.fro Di:sp fay Dt"..es J9

    ( , )

    (el

    ,

    (d)

    FIGURE 2-7 A ras ter-scan""y... tem displa ys an obicc t as aset of d iscrete points acrosseach scan line.

  • 40 CHA PTER 2

    po ints to vertical points (or vlcc verse) nt..'CC'SS

  • 2- , Video Display Deoicee 4'

    FIGURE 2-8 Interlacing scan lines ona raster-scan disp lay. Firs t, all poin ts onthe even-numbered (solid) scan lines ared i&plap d ; 1IU'1l a ll poin ts along theodd-numbered (dashed) lines ared isp layed .

    On some raster-scan systems and TV sets, each fra me is di splayed in twopasses usi ng an intertaced refrt>sh p r oced ure. In the first pass, the beam sweeps.K roSS P\"PI"Y other scan line from top to bottom. After the vertical ret race, thebeam then sweeps out the remaining scan lines (Fig . 2-8). Interlacing of the scanlines in th is wa y allows us to see the entire screen displayed in one-ha lf the timeit wou ld haw ta ken to sw eep across a ll the lines at once from top to bottom .This technique is primarily used with slower refresh rates. On an older, 30 frame-per-second. non-interlaced display, for ins tan ce, some fl icker is noticeable. n utWIth interlacing, each of the two passes can be accomplished in e1- of a second,which brings the refresh ra te nearer to 60 frames per second. This is an effectivetechniq ue for avoid ing flicker- p rovided that ad jacent scan lines con tain similardisplay informat ion.

    Random- Scan DisplaysWhen operated as a random -scan display unit, a CRT has the electron beamdirected only to those parts of the screen where a p icture is to be d isplayed.Pictures arc generated as line drawings, wi th the electron beam tracing out thecomponent lines one after the other, For this reason, random-scan monitors are

  • 42 CHAPTER 2

    (.)

    fiGURE 2-9 Aran don ......an ..., ...tern d rawl'the cumponcn t lines ofanobject in any speci fied lln lt.'r. (0 ) (J '

    contrast. prod uces jagged lines th at a re p lotted ;'IS d iscrete point sets. However,the gree ter fl exibility and improved line.....d rnwing capabilities of raster systemshave resulted in the abandonment of vector technology,

    Color CRT MonitorsA CRT monitor displays color pictures by using a combi nation of phosphorsthat crnit differen t-colored light. The emitted light from the different phosphorsmerge.. In form a single perceived color. which depends on the particular set ofphosphors tha i have been excited.

    One W

  • 2-1 43

    Sccli..nof

    Shadow Mask

    M" gni fk JI

  • 44 CHAPTER 2 Ooermeio ofGropnice SyMNI1S

    extra hand li ng of the p icture information by the RF modu lator and TV circuitrydecreases the quality of d isplayed images.

    Com posite monitors are adaptationscf'Fv sets th at allow bypass ofthe b road-cast circuitry. These di splay devices still require that the picture information becombined, but no carrier signa l is needed . Since pichire informa tion is combinedinto a compos ite signal and then separated by the monitor. the resulting picturequality is st ill not the best a tta inable.

    Co lo r C RTs in gra p hics system.. are d esigned as RG B monitors. These moni-tors lise sha dow-mask methods and take the intensity level for each electron gun(red . green, and blue) di rectly from the computer system without any lnterme-dla te p rocessing . High- quality raster-graphics systems ha ve 2-1 bib per pixel inthe frame buffer, allowing 256 vo ltage settings for each electron gun and near ly17 million color choices for each pixel. An RCDcolor sys tem with 24 bits of storageper pixel is generally referred to as a full-color system or a true-color sys tem.

    Flat-Panel DisplaysAlthough most graphics monitors are still construc ted with CRTs, other tech-nologies are emerging tha t may soon replace CRT monitors. The term flat-paneldi splay refers to a d .1SS of video devices that have reduced volume, weight. andpower requirements compared to a CRT. A significant featu re of flat-panel di s--p lays is that they are thinner th an CRTs, ami we can hang them on walls or wee rthem on our wri sts. Since we can even write on some flat-panel displays, theyarc a lso available as pocke t notcpads. Some additiona l uses for flat-panel d is-p lays are as small TV monito rs, calcula tor screens, pocket vi deo-game screens,laptop computer screens, armrest movie-viewing stations on ai rlines, advertise-men t board s in elevators, and graph ics d isplays in applica tions requiring rugged,portable monitors.

    ' '''"e can separate flat-panel displays into two categories: emissive di splaysand n onernisslve d isplays. The emissive displays (or em itters) are devices thatconvert electrical energy into light. Plasma panels , thin-film electro luminescentd isplays, and ligh t-emitting diodes are examples of emissive displays. Flat CRTshave also been devised . in which electron beams arc accelerated parallel to thescreen and then defl ected 90" onto the screen. But flat CRT5 have not proved to be assuccess ful as other emissive devices. Nonemissive disp lays (or nonemitl ers) useoptical effects to convert sunligh t or light from some other so urce into graphicspa tterns. The most important example of a nonemissivc fla t-panel di splay is aJiqu ld-crystal d evice.

    Plasma panels, also cal led gas-di scharge displays, are constructed by fi llingthe region between tvvc glass pla tes with a mix ture of gaSl..'S tha i usually includesneon. A series of vertical cond ucting ribbons is p laced on one glass panel. and aset of horizonta l conducti ng ribbons is built into the other glass panel (Fig. 2-11 ).Firing voltages app lied to an intersec ting pair of horizontal and vertica l cond uc-tors ca use the gas at the intersection of the two conductors to brea k down intoa glowing plasma of elect rons and ions. Picture definition is stored in a refreshbuffer, and the fi ring voltages are app lied to refres h the pixel positions (at the in-tersec tions of the conductors) 60 times per second . Alternating-curren t methodsarc used to pro vide faster applica tion of the firing voltages and, thu s, brighterd isplays. Separation betw een pixels is prov ided by the elec tric field of the con-ductors. Figure 2~12 shows a high-definition plasma panel. One d isadvantageof plasma panels has been that th ey were st rict ly monochromatic devices, butsystems arc now available ...... ith m ultlcolor capabilltlcs.

  • Conductors

    Gla~~ PIal!'

    2-1 Video Display D("I..' ict.'s 45

    IGURE 2-11devtce.

    Ba..k dt>">ign of a plasma-panel d isplay

    Cl>nt ltlch ll ~

    FIGURE 2-12 A plasma-panel displaywith a resolution of 2lJ.1S bv 20-18 and a screend iagonal of 1.5 meters. (Co;" trs.Y of PIlJ)IOllics

    5y,t" "I ~ , )

    Phosphor _+--r-qc- Glass Platt

    FIGURE 2-13 Basicdesign of a thin-filmelectroluminescent d isplaydevice.

    Thin-fi lm elec trol uminescent d isplays are similar ill cons truction to plasmapanels. The difference is tha i the region bctwr..-cn the g lass plates i:=. filled with .1phosphor, such~ Line sulfide doped with manganese. instead of d gas (Fig. 2-13).When .'1 sufficien tly high voltage is applied to a pair of crossing electrod es. thephosphor becomes a conduc tor in the area of the intersection of the two electrodes.Electrical cncQ:;Y is absorbed b)' the manganese atoms, which then release thet.'I1CC);y as a spot of light similar to the glowing plasma effec t in d plasma panel.

  • 46 CHAPTER 2

    . ..... _ .. ,ft _.~.~' -

    'A"'"' I)~.

    """

    -.

    M'l_?OI Y j ,."V". j,j !Hi ' ''. ' , ! 'MtM" 'n

    FIGURE 2-14 Ahandheld calcula tor with anLeU screen . (Corl rtt'~y tJf Tt'x.NInstmmenIs .)

    Electroluminescent displays requ ire more po wer than plasma panels. and goodco lo r d isplays a rc harde r to achieve.

    A third type of emissive device is the ltght-emltti ng diode (LED). A matrix ofdiodes is arranged to torrn the pixel positions in the d isplay, and picture definitionis sto red in a refresh buffer. As in scan-line refreshing: uf a CRT, informa tion isread from the refresh buffer and conver ted to vol tage leve ls that are applied tothe d iodes to prod uce the ligh t pattern.;; in the di spl ay.

    Liquid-crystal disp lays (Le Ds) are commonly used in sma ll systems, such aslap top computers and calcula tors (Fig. 2-14). These nonemissive devices prod ucea pictu re by passtng polarized light from the surroundings or from

  • 2 - 1 47

    ;:'1\. ('1. WI.' ap ply it voltage to the two intersec ting cond uctors to align the molec uIt'S:-Q that the light is not twisted. ntis type of fla t-panel device is referred to as apasslve-matrlx LCD. Picture definiti ons are stored in it refresh buffer, and the-creen is refreshed 01 1 the rail' of 60 frames per second, as in the emissive de-.Ices. Backlight ing is also commonly applied using solid -state electronic devices,,",-1 tha t the sys tem is not comple tely d ependen t on outside light sources. Colorscan be displ ayed by using d ifferen t materia ls or d yes and by placing a triad ofcolor pixels at each screen location. Another method for constructing LeOs is toplace a transistor a t each p ixel loca tion. using thin-film transistor technology.Thetransistors an> used to con trol the voltage at pixel locations and to prevent chargefrom grad ually leaking out of the liquid-crystal cells. These d evices are called.active-matrix di splays.

    Th ree- Dimensional Viewing DevicesCrephics monitors for the di splay of three-dimensional scenes ha ve been dt.'-vi sed us ing a technique that reflects a CRT image from a vibrating. flexible mirrorFig. 2-16). A.. the varifocal mirror vibrates , it changes focallength . TIll-'S' vib ra-

    tions are synchronized w ith the d isp lay of an object on a CRT so that each pointon the object is reflected from the mirror into a spatial position correspondingto the distance of that point from a specified viewing locati on. This .1110\\'5 us towalk around an object or scene and view it from d ifferent sides .

    Figure 2-17 shows the Ccnisco SpaceGraph system, which uses a vibret-ing mirror tu projec t three-dimensional objects into a 25-cm by 23r Vic... er

    CRT

    'I inung and('cll1TrolSystem

    - GURE 2-16 Operation of a three-dimensional d tsptaysystem u~in); J. vibrating mirror that ch.mgl.'t" focal length 10match Itlt-- deplhs (If I)( lin l~ 111 a scene.

    FIGURE 2-1 7 Thl'Sp.1l'l.cIS in threedbn en...iono; u..in~ a \;bratin~ flexible mirror.(Collnrsy

  • ., CHAPTE R 2 OVt'rvil'W of e mp/lies Systems

    " SliC'5 " of objects selected at di ffe rent depths. Such systems have been u sed inmedical applications to analyze d ata from ul trasonography and CAT seen devices,in geological applications to ana lyze topological and seismic data, in design appli-cations inv olving solid objects, and in th ree-dimensional simulations of systems,such as molecu les and terrain.

    Ste reoscopic and Virtual-Reality SystemsAno ther technique for rep resenting ,"I three-d imensional object is to d isplay stereo-scopic views of the object. Th is meth od does not produce true three-dimensionalimages, but it docs provide a three-d imensional effect by p resenting a d iffe rentview to each eye ofan observer so tha t scenes d o appear to have depth (Fig. 2-18).

    To obtain a stereoscopic p rojection, we mu st obtain 1"\"0 views of a scenegenerated with viewing directions along the lines from the posi tion of each eye(left and right)to the scene. weca n construct the two views as computer-generatedscenes with differen t viewing positions, or we can use a stereo camera pa ir topho tograph an object or scene. W hen we simultaneous ly look a t the left viewwith the left eye and the right view with the right eye, the two views merge intoa single Image and we perceive a scene w ith depth. Figu re 2-19 shows two view!';of a computer-generated scene for stereoscopic projection. To Increase view ingcomfort, the areas a t the left and right edges of th is scene tha t arc visible to onlyone eye have been eliminated .

    One way to produce a stereoscopic e ffect on a raster system is to display eachof the 1"\v0 d ews on alternate refresh cycles . The screen is viewed through glasses,wi th each lens designed to ac t as a rapid ly alternating shutter tha i is synch ronizedto block ou t one of the views. Figure 2-20 shows a pair of stereoscopic glassesconstructed w ith liquid-crysta l shutters and an infrared emitter that synchron izesthe glasses with the views on th e screen .

    Stereoscopic view ing is abo a component in virt ual-reality sys tems, whereusers can step into a scene and interact with the environment. A headset(Fig. 2-21) con taining an optical system to generate the stereoscop ic views can

    FIGURE 2-1 B Simula tedview ing nfa ste reoscopicprojection . (C(w rt

  • 2- 1 Video Display Det'ices 49

    (3) (b)

    FIGURE 2-19 A stereoscopic view ing pan . (Ctlln tesy of Jerry Farm. )

    ~ .., " '-

    FI GURE 2- 20 Glasses for view ing astereoscopic scene and an infrared synchronizingemi tter. (COflrksy of StcrroGml"Jics Corporotion.i

    FIGURE 2-21 A headset used in virtual-reality systems.(Courtesy a/Vir! lIa! Research.)

    ce used in conjunction with interactive input devices to locate and ma nipulateobjects in the scene . A sensing sys tem in the headset kee ps track of the viewer'srosition, so that the front and back of objects can be seen as the viewer "walksthrough" and interac ts with the display. Another method for crea ting a virtual--eality environme nt is to use projectors to generate a scene- within an arrangem entci walls, as in Figure 2-22, w here a view er interacts with a virtua l d isp lay usingstereoscopic glasses and da ta gloves (Section 2-4).

    Lower-cost, interactive virtual-reality environments can be set up using azrephics monitor, stereoscopic glasses, and a head-tracking device. Figu re 2-23~hOW5 an ultrasou nd tracking device wi th six degrees of freedom. The trac k-' ~ g device is placed above the video monitor and is used to record head move--tents, so that the vi ev...ing position for a scene can be chan ged as head position':"'13.:1g e !'>.

  • 50 CHAPTER 2

    FIGURE 2-22 A molecular biologis t analyzingmolecular structures ins ide a virtual-reality svs tomcalled the Trimcnsion ReaCTor. The "PokespoccPinch gloves" enable the scientist to gra~p andrearra nge virtu al objects in a projected scene.(Courtesy Silicoll Grap!lics, l 11C. l1I"t TrnncnsionS.lIsftm., RcaCTor. 2003 SGI. AU risllt,: resm.'f.1.)

    FIGURE 2-23 An ultrasound trackin g deviceused with stereoscopic glasses to record changes Ina viewer 's head posit ion. (CtllirtL'sy vf 5temJGmpi1lcsCtwporatioll.)

    RASTER-SCAN SYSTEMSInteract ive raster-graphics sys tems typically employ sever..l processing units. Inadd ition to the cen tral p rocessing unit, or CPU, a speciel-purpose processor, ca lledthe video controller or di splay contro ller, is used to control the opera tion of thed isplay d evice. Organization of d simple raster system is shown in Fig. 2-2-1. Here,the frame buffer can be anywhere in the system memory. and the video controlleraccesses the fra me buffer to refresh the screen. In ad d ition to the video contro ller,more sophisticated raster systems employ other processors as coprocessors andaccelera tors to implement various graph ics operations.

    Video ControllerFigure 2-25 shows a commonly used organiza tion for raster systems . A fixed areaof the system memory is reserved for the frame buffer. and the video controller isgiven d irect access to the frame-buffer memory.

    Frame-buffer locations. and the correspondi ng screen positions , are reter-cnccd in Car tesian coo rdinatcs. Jnon applica tion progra m. ,,,'Cusc the commands

    -,

    FIGURE 2-2'Arch itectu re of a simpleraster-graphks syst(>m.

    CPU

    IS\'SICm

    Memor y

    ISYSIl'lJI Hu~

    I

    i

    VideoC, " ll rol l

  • r'eu

    I'~" t l'Tfl~1 .mo0

    t

    !'ram.:BUI1..:r

    IVlonuut

    .....

    -

    2-2 51

    I

    J

  • S2 CHAPTER 2 Ol't'roirn.' ofGraphics S1fS t~I/f_~

    p ixels. Initia lly. the x register is set to a and the y register is set to the valuefor the top scan line. The contents of the frame buffer at this pixel position areth en retrieved and used 10 set the intensity of the CRT beam. Then the x reg-ister is incremented by 1, and the process is repeated for the next p ixel on thetop scan line. Th is proced ure continues for each pixel a long the top scan line.After the last p ixel on the top scan Hne has been p rocessed. the .r register is re-set to 0 and the y register is set to the value for the next scan line d ocvn fromthe top of the screen. Pixels along th is scan line arc then prOCL~S4...-d in turn, andth e procedu re is repea ted for each successive scan line. After cycling througha ll p ixels a long the bottom scan li nt', the video controller resets the registersto the first pixel position on the top scan line and the refresh process startsover.

    Since the screen mu st be refreshed at a rate of a t least 60 fra mes per second,the simple procedure illu strated in Fig. 2-27 may not be accommodated by typicalRAM chips if the cycle time is too slow. To speed up pixel processing, videocontrollers can retrieve multiple p ixel values from the refresh buffer on each pass.The multiple pixel intensities are then stored in a sepa rate register and used tocontrol the CRT beam in tensity for a grou p of adjacent pixels. Whe n tha t groupof p ixels has been processed, the next block of pixel values is rt>trievli'd from theframe buffer.

    A video controller can be designed to perform a number of other opere-ttons. For various applications, the video con troller can retrieve pixel valuesfrom different memory areas on di fferent refresh cycles. In some systems, forexample, multiple frame buffe rs are often provid ed so tha t one b uffer can beused for refreshing while pixel values are being