Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10: Computer Graphics Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Modified by Senem Kumova Metin
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10-2 Chapter 10: Computer Graphics 10.1 The Scope of Computer Graphics 10.2 Overview of 3D Graphics 10.3 Modeling 10.4 Rendering
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley D // 3D Graphics // Image processing 2D Graphics: Deals with manipulating two-dimensional images(converts two-dim. Shapes in patterns of pixels to produce an image) 3D Graphics: Deals with producing and displaying images of three-dimensional virtual scenes. Image Processing: Analyses images
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10-4 Figure 10.1 A “photograph” of a virtual world produced using 3D graphics (from Toy Story by Walt Disney Pictures/Pixar Animation Studios) © Corbis/Sygma
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10-5 Overview of 3D Graphics A process of 3 steps : –Modeling : Designing a set of objects which are constructed from digitally encoded algorithms –Rendering : Producing 2D image of the scene (Determining the appearance of each pixel and storing them in frame buffer) –Displaying
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10-6 Figure 10.2 The 3D graphics paradigm
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Modeling Objects Shape: Represented by a polygonal mesh obtained from 1.Traditional mathematical equations (e.g ) 2.Bezier curves and surfaces 3.Procedural models 4.Other methods being researched Surface: Can be represented by a texture map (Texture mapping : Associating color patterns with an object’s surface)
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10-8 Figure 10.3 A polygonal mesh for a sphere A collection of small flat surfaces = planar patches Collection of patches = polygonal mesh
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 10-9 Figure 10.4 A Bezier curve
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure 10.5 Growing a polygonal mesh for a mountain range
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure 10.6 A scene from Shrek 2 by Dreamworks SKG (© Dreamworks/The Kobal Collection) Search for realism : Modeling of skin Modeling cloth Modeling of human hair
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Modeling entire scene Required information includes –Models of objects –Locations –Sizes –Orientations within the scene This collection of information is called scene graph
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2. Rendering Determining how objects in a scene graph would appear when projected onto the projection plane Rendering process involves –Light –Surface Interaction –Clipping, Scan conversion, Hidden –surface removal = Rendering pipeline –Shading 10-13
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Light –Surface Interaction: Reflection Versus Refraction Reflection: Light rays bounce off surface. –Specular light –Diffuse light –Ambient light Refraction: Light rays penetrate surface.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure 10.7 Reflected light
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure 10.8 Specular versus diffuse light Specular light = Parallel light rays reflected from smooth surface => the color of original light Diffuse light = Scattered light rays reflected from non-smooth surface => the color of the object
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure 10.9 Refracted light
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Rendering Pipeline Consists of traditional algorithms for clipping, scan conversion, and shading Often implemented in firmware Used as an abstract tool in graphics applications
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley RENDERING PIPELINE Figure Identifying the region of the scene that lies inside the view volume View Volume : The region in 3 dimensional scene that contains the objects
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Rendering Pipeline Clipping: Restricts attention to objects within view volume Scan Conversion(Rastering): Associates pixel positions with points in scene Shading: Determines appearance of points associated with pixels
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure The scan conversion of a triangular patch
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Scan conversion problems Hidden-surface removal : Indentifying and discarding point in a scene that are blocked from view (e.g. Back face elimination) –Painter’s algorithm (Closer objects override previous result) –Z-buffer (depth buffer, focus on individual pixels) 10-22
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Shading Techniques Shading : Determining the appearance of patches which are selected by rendering process –Flat Shading: Creates faceted appearance –Bump Mapping: Creates bumpy, rounded appearance –Gouraud and Phong Shading: Creates smooth, rounded appearance
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure A sphere as it might appear when rendered by flat shading
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure A conceptual view of a polygonal mesh with normal vectors at its vertices
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Figure A sphere as it might appear when rendered using bump mapping
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Rendering-Pipeline Hardware Graphic cards OpenGL (open graphics library) 10-27