Skip to main content Skip to main navigation


A top-down, programming-oriented approach to introductory computer graphic.

Computer animation and graphics are now prevalent in everyday life from the computer screen, to the movie screen, to the smartphone screen. The growing excitement about WebGL applications and their ability to integrate HTML5, inspired the authors to exclusively use WebGL in creating Interactive Computer Graphics—the only introduction to computer graphics text for undergraduates that fully integrates WebGL and emphasizes application-based programming. The top-down, programming-oriented approach allows for coverage of engaging 3D material early in the course so students immediately begin to create their own 3D graphics, while the application programming interface (API) makes it easier to teach key graphics topics, including three-dimensional transformations, lighting and shading, client–server graphics, modeling, and implementation algorithms. The new edition uses WebGL and JavaScript for all the examples.


With the 8th Edition, and for the first time, Interactive Computer Graphics moves into the world of interactive electronic textbooks, enabling students to experiment and view code and examples while reading. The convenient, simple-to-use mobile reading experience extends learning beyond class time.


For courses in computer science and engineering.

Pearson eText is a simple-to-use, mobile-optimized, personalized reading experience. It lets students add bookmarks, highlight, and take notes all in one place, even when offline. Seamlessly integrated videos engage students and give them access to the help they need, when they need it. Educators can easily schedule readings and share their own notes with students so they see the connection between their eText and what they learn in class — motivating them to keep reading, and keep learning. And, reading analytics offer insight into how students use the eText, helping educators tailor their instruction.


NOTE: This ISBN is for the Pearson eText access card. For students purchasing this product from an online retailer, Pearson eText is a fully digital delivery of Pearson content and should only be purchased when required by your instructor. In addition to your purchase, you will need a course invite link, provided by your instructor, to register for and use Pearson eText.

Table of contents


1.1 Applications of Computer Graphics

1.1.1 Display of Information

1.1.2 Design

1.1.3 Simulation and Animation

1.1.4 User Interfaces

1.2 A Graphics System

1.2.1 Pixels and the Framebuffer

1.2.2 The CPU and the GPU

1.2.3 Output Devices

1.2.4 Input Devices

1.3 Images: Physical and Synthetic

1.3.1 Objects and Viewers

1.3.2 Light and Images

1.3.3 Imaging Models

1.4 Imaging Systems

1.4.1 The Pinhole Camera

1.4.2 The Human Visual System

1.5 The Synthetic-Camera Model

1.6 The Programmer’s Interface

1.6.1 The Pen-Plotter Model

1.6.2 Three-Dimensional APIs

1.6.3 A Sequence of Images

1.6.4 The Modeling—Rendering Paradigm

1.7 Graphics Architectures

1.7.1 Display Processors

1.7.2 Pipeline Architectures

1.7.3 The Graphics Pipeline

1.7.4 Vertex Processing

1.7.5 Clipping and Primitive Assembly

1.7.6 Rasterization

1.7.7 Fragment Processing

1.8 Programmable Pipelines

1.9 Performance Characteristics

1.10 OpenGL Versions and WebGL

Summary and Notes

Suggested Readings



2.1 The Sierpinski Gasket

2.2 Programming Two-Dimensional Applications

2.3 The WebGL Application Programming Interface

2.3.1 Graphics Functions

2.3.2 The Graphics Pipeline and State Machines

2.3.3 OpenGL and WebGL

2.3.4 The WebGL Interface

2.3.5 Coordinate Systems

2.4 Primitives and Attributes

2.4.1 Polygon Basics

2.4.2 Polygons in WebGL

2.4.3 Triangulation

2.4.4 Text

2.4.5 Vertex Attributes

2.5 Color

2.5.1 RGB Color

2.5.2 Color Tables

2.5.3 Setting of Color Attributes

2.6 Viewing

2.6.1 The Orthographic View

2.6.2 Two-Dimensional Viewing

2.7 Control Functions

2.7.1 The HTML Canvas

2.7.2 Aspect Ratio and Viewports

2.7.3 Application Execution

2.8 The Gasket Program

2.8.1 Sending Data to the GPU

2.8.2 Rendering the Points

2.8.3 The Vertex Shader

2.8.4 The Fragment Shader

2.8.5 Combining the Parts

2.8.6 The initShaders Function

2.8.7 The init Function

2.8.8 Reading the Shaders from the Application

2.9 Polygons and Recursion

2.10 The Three-Dimensional Gasket

2.10.1 Use of Three-Dimensional Points

2.10.2 Use of Polygons in Three Dimensions

2.10.3 Hidden-Surface Removal

Summary and Notes

Code Examples

Suggested Readings



3.1 Animation

3.1.1 The Rotating Square

3.1.2 The Display Process

3.1.3 Double Buffering

3.1.4 Using a Timer

3.1.5 Using requestAnimationFrame

3.2 Interaction

3.3 Input Devices

3.4 Physical Input Devices

3.4.1 Keyboard Codes

3.4.2 The Mouse and the Trackball

3.4.3 Data Tablets,Touch Pads, and Touch Screens

3.4.4 Multidimensional Input Devices

3.4.5 Logical Devices

3.4.6 Input Modes

3.4.7 Clients and Servers

3.5 Programming Event-Driven Input

3.5.1 Events and Event Listeners

3.5.2 Adding a Button

3.5.3 Menus

3.5.4 Using Key Codes

3.5.5 Sliders

3.6 Position Input

3.7 Window Events

3.8 Gesture and Touch

3.9 Picking

3.10 Building Models Interactively

3.11 Design of Interactive Programs

Summary and Notes

Code Examples

Suggested Readings



4.1 Scalars, Points, and Vectors

4.1.1 Geometric Objects

4.1.2 Coordinate-Free Geometry

4.1.3 The Mathematical View: Vector and Affine Spaces

4.1.4 The Computer Science View

4.1.5 Geometric ADTs

4.1.6 Lines

4.1.7 Affine Sums

4.1.8 Convexity

4.1.9 Dot and Cross Products

4.1.10 Planes

4.2 Three-Dimensional Primitives

4.3 Coordinate Systems and Frames

4.3.1 Representations and N-Tuples

4.3.2 Change of Coordinate Systems

4.3.3 Example: Change of Representation

4.3.4 Homogeneous Coordinates

4.3.5 Example: Change in Frames

4.3.6 Working with Representations

4.4 Frames in WebGL

4.5 Matrix and Vector Types

4.5.1 Row Versus Column Major Matrix Representations

4.6 Modeling a Colored Cube

4.6.1 Modeling the Faces

4.6.2 Inward- and Outward-Pointing Faces

4.6.3 Data Structures for Object Representation

4.6.4 The Colored Cube

4.6.5 Color Interpolation

4.6.6 Displaying the Cube

4.6.7 Drawing by Elements

4.6.8 Primitive Restart

4.7 Affine Transformations

4.8 Translation, Rotation, and Scaling

4.8.1 Translation

4.8.2 Rotation

4.8.3 Scaling

4.9 Transformations in Homogeneous Coordinates

4.9.1 Translation

4.9.2 Scaling

4.9.3 Rotation

4.9.4 Shear

4.10 Concatenation of Transformations

4.10.1 Rotation About a Fixed Point

4.10.2 General Rotation

4.10.3 The Instance Transformation

4.10.4 Rotation About an Arbitrary Axis

4.11 Transformation Matrices in WebGL

4.11.1 Current Transformation Matrices

4.11.2 Basic Matrix Functions

4.11.3 Rotation, Translation, and Scaling

4.11.4 Rotation About a Fixed Point

4.11.5 Order of Transformations

4.12 Spinning of the Cube

4.12.1 Uniform Matrices

4.13 Smooth Rotations

4.13.1 Incremental Rotation

4.14 Quaternions

4.14.1 Complex Numbers and Quaternions

4.14.2 Quaternions and Rotation

4.14.3 Quaternions and Gimbal Lock

4.15 Interfaces to Three-Dimensional Applications

4.15.1 Using Areas of the Screen

4.15.2 A Virtual Trackball

4.15.3 Implementing the Trackball with Quaternions

Summary and Notes

Code Examples

Suggested Readings



5.1 Classical and Computer Viewing

5.1.1 Classical Viewing

5.1.2 Orthographic Projections

5.1.3 Axonometric Projections

5.1.4 Oblique Projections

5.1.5 Perspective Viewing

5.2 Viewing with a Computer

5.3 Positioning of the Camera

5.3.1 From the Object Frame to the Camera Frame

5.3.2 Two Viewing APIs

5.3.3 The Look-At Function

5.4 Parallel Projections

5.4.1 Orthogonal Projections

5.4.2 Parallel Viewing with WebGL

5.4.3 Projection Normalization

5.4.4 Orthogonal Projection Matrices

5.4.5 Oblique Projections

5.4.6 An Interactive Viewer

5.5 Perspective Projections

5.5.1 Simple Perspective Projections

5.6 Perspective Projections with WebGL

5.6.1 Perspective Functions

5.7 Perspective Projection Matrices

5.7.1 Perspective Normalization

5.7.2 WebGL Perspective Transformations

5.7.3 Perspective Example

5.8 Hidden-Surface Removal

5.8.1 Culling

5.9 Displaying Meshes

5.9.1 Displaying Meshes as Surfaces

5.9.2 Polygon Offset

5.9.3 Walking Through a Scene

5.10 Projections and Shadows

5.10.1 Projected Shadows

5.11 Shadow Maps

Summary and Notes

Code Examples

Suggested Readings



6.1 Light and Matter

6.2 Light Sources

6.2.1 Color Sources

6.2.2 Ambient Light

6.2.3 Point Sources

6.2.4 Spotlights

6.2.5 Distant Light Sources

6.3 The Phong Lighting Model

6.3.1 Ambient Reflection

6.3.2 Diffuse Reflection

6.3.3 Specular Reflection

6.3.4 The Modified Phong Model

6.4 Computation of Vectors

6.4.1 Normal Vectors

6.4.2 Angle of Reflection

6.5 Polygonal Shading

6.5.1 Flat Shading

6.5.2 Smooth and Gouraud Shading

6.5.3 Phong Shading

6.6 Approximation of a Sphere by Recursive Subdivision

6.7 Specifying Lighting Parameters

6.7.1 Light Sources

6.7.2 Materials

6.8 Implementing a Lighting Model

6.8.1 Applying the Lighting Model in the Application

6.8.2 Efficiency

6.8.3 Lighting in the Vertex Shader

6.9 Shading of the Sphere Model

6.10 Per-Fragment Lighting

6.11 Nonphotorealistic Shading

6.12 Global Illumination

Summary and Notes

Code Examples

Suggested Readings



7.1 Buffers

7.2 Digital Images

7.3 Mapping Methods

7.4 Two-Dimensional Texture Mapping

7.5 Texture Mapping in WebGL

7.5.1 Texture Objects

7.5.2 The Texture Image Array

7.5.3 Texture Coordinates and Samplers

7.5.4 Texture Sampling

7.5.5 Working with Texture Coordinates

7.5.6 3D Texture Mapping

7.5.7 Multitexturing

7.6 Environment Maps

7.7 Reflection Map Example

7.8 Bump Mapping

7.8.1 Finding Bump Maps

7.8.2 Bump Map Example

Summary and Notes

Code Examples

Suggested Readings



8.1 Blending Techniques

8.1.1 Opacity and Blending

8.1.2 Image Blending

8.1.3 Blending in WebGL

8.1.4 Antialiasing Revisited

8.1.5 Back-to-Front and Front-to-Back Rendering

8.1.6 Scene Antialiasing and Multisampling

8.2 Image Processing

8.2.1 Other Multipass Methods


8.4 Framebuffer Objects

8.5 Multi-pass Rendering Techniques

8.5.1 Ambient Occlusion

8.5.2 Deferred Lighting

8.6 Buffer Ping-Ponging

8.7 Picking

8.8 Shadow Maps

8.9 Projective Textures

Summary and Notes

Code Examples

Suggested Readings



9.1 Geometries and Instances

9.2 Hierarchical Models

9.3 A Robot Arm

9.4 Trees and Traversal

9.4.1 A Stack-Based Traversal

9.5 Use of Tree Data Structures

9.6 Animation

9.7 Graphical Objects

9.7.1 Methods, Attributes, and Messages

9.7.2 A Cube Object

9.7.3 Instancing in WebGL

9.7.4 Objects and Hierarchy

9.7.5 Geometric and Nongeometric Objects

9.8 Scene Graphs

9.9 Implementing Scene Graphs

9.9.1 three.js Examples

9.10 Other Tree Structures

9.10.1 CSG Trees

9.10.2 BSP Trees

9.10.3 Quadtrees and Octrees

Summary and Notes

Code Examples

Suggested Readings



10.1 Algorithmic Models

10.2 Physically Based Models and Particle Systems

10.3 Newtonian Particles

10.3.1 Independent Particles

10.3.2 Spring Forces

10.3.3 Attractive and Repulsive Forces

10.4 Solving Particle Systems

10.5 Constraints

10.5.1 Collisions

10.5.2 Soft Constraints

10.6 A Simple Particle System

10.6.1 Displaying the Particles

10.6.2 Updating Particle Positions

10.6.3 Collisions

10.6.4 Forces

10.6.5 Flocking

10.7 Agent-Based Models

10.8 Using Point Sprites

10.9 Language-Based Models

10.10 Recursive Methods and Fractals

10.10.1 Rulers and Length

10.10.2 Fractal Dimension

10.10.3 Midpoint Division and Brownian Motion

10.10.4 Fractal Mountains

10.10.5 The Mandelbrot Set

10.10.6 Mandelbrot Fragment Shader

10.11 Procedural Noise

Summary and Notes

Code Examples

Suggested Readings



11.1 Representation of Curves and Surfaces

11.1.1 Explicit Representation

11.1.2 Implicit Representations

11.1.3 Parametric Form

11.1.4 Parametric Polynomial Curves

11.1.5 Parametric Polynomial Surfaces

11.2 Design Criteria

11.3 Parametric Cubic Polynomial Curves

11.4 Interpolation

11.4.1 Blending Functions

11.4.2 The Cubic Interpolating Patch

11.5 Hermite Curves and Surfaces

11.5.1 The Hermite Form

11.5.2 Geometric and Parametric Continuity

11.6 Be´ zier Curves and Surfaces

11.6.1 Be´ zier Curves

11.6.2 Be´ zier Surface Patches

11.7 Cubic B-Splines

11.7.1 The Cubic B-Spline Curve

11.7.2 B-Splines and Basis

11.7.3 Spline Surfaces

11.8 General B-Splines

11.8.1 Recursively Defined B-Splines

11.8.2 Uniform Splines

11.8.3 Nonuniform B-Splines

11.8.4 NURBS

11.8.5 Catmull-Rom Splines

11.9 Rendering Curves and Surfaces

11.9.1 Polynomial Evaluation Methods

11.9.2 Recursive Subdivision of Be´ zier Polynomials

11.9.3 Rendering Other Polynomial Curves by Subdivision

11.9.4 Subdivision of Be´ zier Surfaces

11.10 The Utah Teapot

11.11 Algebraic Surfaces

11.11.1 Quadrics

11.11.2 Rendering of Surfaces by Ray Casting

11.12 Subdivision Curves and Surfaces

11.12.1 Mesh Subdivision

11.13 Mesh Generation from Data

11.13.1 Height Fields Revisited

11.13.2 Delaunay Triangulation

11.13.3 Point Clouds

11.14 Graphics API support for Curves and Surfaces

11.14.1 Tessellation Shading

11.14.2 Geometry Shading

Summary and Notes

Code Examples

Suggested Readings



12.1 Basic Rendering Strategies

12.2 Rendering Pipeline

12.2.1 Modeling

12.2.2 Geometry Processing

12.2.3 Rasterization

12.2.4 Fragment Processing

12.3 Clipping

12.3.1 Clipping

12.3.2 Bounding Boxes and Volumes

12.3.3 Clipping Against Planes

12.4 Rasterization

12.5 Polygon Rasterization

12.5.1 Inside—Outside Testing

12.5.2 WebGL and Concave Polygons

12.6 Hidden-Surface Removal

12.6.1 Object-Space and Image-Space Approaches

12.6.2 Sorting and Hidden-Surface Removal

12.6.3 Scan Line Algorithms

12.6.4 Back-Face Removal

12.6.5 The z-Buffer Algorithm

12.6.6 Depth Sort and the Painter’s Algorithm

12.7 Hardware Implementations

12.8 Antialiasing

12.9 Display Considerations

12.9.1 Color Systems

12.9.2 The Color Matrix

12.9.3 Gamma Correction

12.9.4 Dithering and Halftoning

Summary and Notes

Suggested Readings



13.1 Going Beyond Pipeline Rendering

13.2 Ray Tracing

13.3 Building a Simple Ray Tracer

13.3.1 Recursive Ray Tracing

13.3.2 Calculating Intersections

13.3.3 Ray-Tracing Variations

13.4 The Rendering Equation

13.5 Global Illumination and Path Tracing

13.6 RenderMan

13.7 Parallel Rendering

13.7.1 Sort-Middle Rendering

13.7.2 Sort-Last Rendering

13.7.3 Sort-First Rendering

13.8 Implicit Functions and Contour Maps

13.8.1 Marching Squares

13.8.2 Marching Triangles

13.9 Volume Rendering

13.9.1 Volumetric Data Sets

13.9.2 Visualization of Implicit Functions

13.10 Isosurfaces and Marching Cubes

13.11 Marching Tetrahedra

13.12 Mesh Simplification

13.13 Direct Volume Rendering

13.13.1 Assignment of Color and Opacity

13.13.2 Splatting

13.13.3 Volume Ray Tracing

13.13.4 Texture Mapping of Volumes

13.14 Image-Based Rendering

13.14.1 Distance from Stereo Pairs

13.14.2 The Fundamental Matrix

13.15 Virtual, Augmented, and Mixed Reality

13.16 A Final Example

Summary and Notes

Suggested Readings



A.1 Shaders in the HTML file

A.2 Reading Shaders from Source Files


B.1 Scalars

B.2 Vector Spaces

B.3 Affine Spaces

B.4 Euclidean Spaces

B.5 Projections

B.6 Gram-Schmidt Orthogonalization

Suggested Readings



C.1 Definitions

C.2 Matrix Operations

C.3 Row and Column Matrices

C.4 Rank

C.5 Change of Representation

C.6 The Cross Product

C.7 Eigenvalues and Eigenvectors

C.8 Vector and Matrix Objects

Suggested Readings



D.1 Sampling Theory

D.2 Reconstruction

D.3 Quantization

For teachers

All the material you need to teach your courses.

Discover teaching material