*CS352/CmpE352
Computer Graphics I
Spring 2002-03*

**Last Updated:**
May 16, 2003

**Highlights:
**Lecture Outlines are Complete Now!

Assignments/Programs Page, Course Outline

**Instructor**:
Dr. Sohaib A Khan

email: my_first_name at lums dot edu dot pk

Office Hrs: MW 11:15-12:45

**Teaching Assistant**:
Sadaf Shams

email: sadafs at lums dot edu dot pk

Office Hrs: M-F 11:00-1:00 in Lab2

**Meeting Times**:
MW 8:30 - 10:10 in A5

**Prerequisite**:

Expertise in C++, some Linear Algebra

Math221, CS213

**Textbooks**

[Shirley] Fundamentals of Computer Graphics, Peter Shirley, A. K. Peters, 2002

**Reference Books**

[Angel] Interactive
Computer Graphics: A Top Down Approach using OpenGL, Edward Angel, Addison Wesley,
3rd Edition 2003

[Mortenson]

*Additional Books
on Reserve in Library*

[FvDFH] Computer Graphics, Principles and Practice, Foley, vanDam, Feiner, Hughes
(several different editions)

[Baker] Hearn and Baker, Computer Graphics

Some SIGGRAPH proceedings are also on reserve**
**

**Lecture 1**
- Monday Mar 3

Reading: Angel Ch 1 (about half)

General introduction of course and computer graphics [What is Computer Graphics? Cornell]

- Object Rendering
- Discussion on steps involved in generating the rotating cube
- Representation
- Transformations
- Computation of Camera View
- Hidden Line Removal
- Clipping
- Shading / Lighting / Shadows

- Goals of Computer
Graphics
- Photorealistic
Rendering
- Ray Tracing
- Radiosity
- Physically based models
- Image based Rendering [www.debevec.org]

- Non-Photorealistic
Rendering

www.red3d.com/cwr/npr- Toon Rendering
- Entertainment or educational value

- Photorealistic
Rendering
- Application areas, Research areas
- Computer Graphics in Films

Useful set of online links http://www.graphics.cornell.edu/online/links.html

**Lecture 2**
- Wednesday Mar 5

Reading: Angel Ch 1 (completed)

FUN paper: "Escherization" in SIGGRAPH 2000

I followed Angel more closely today and discussed the following topics:

- Image Formation
- Objects
- Viewer
- Lighting

- Colors and response of eye
- The Pin-Hole
Camera
- Perspective Equations (you should be able to derive the equations, and understand the effect of all terms)
- Field of View
- Depth of Field

- Synthetic Camera Model
- Terms: Projector, Center of Projection, Projection Plane
- Defining the Synthetic Camera
- Graphics Hardware
- Display Processors
- Graphics Pipeline

Check out Assignments/Programs page

**Lecture 3-4
- **Monday
Mar 10, Wed Mar 12

Reading: Shirley Ch 2

Optional Reading: Mortensen Ch 1, parts of Angel Ch 4

- Elementary Math Review - Trigonometry
- Primitives -
Covered basic things about the following. More detailed treatment is in Mortenson
Chapters 8, 9, 11 for those interested, but you are not responsible for this
reading yet. I will cover the basic points in a handout.
- Point
- Line
- Polygon

- Segment-Intersection algorithm [See handout in common folder]
- Polygon-Point,
Inside Outside Algorithm
- Parity Testing approach
- Checking for side with all line segments

- Vectors
- Operations (addition, scalar multiplication, subtraction)
- Dot and cross product (visualization and properties)
- Basis
- linear independence
- orthonormal bases

- Global vs Local Coordinate systems
- 2D Curves
- Implicit
- Parametric

- 3D Surfaces
- Implicit
- Equation of a plane given one point and normal
- Equation of a plane given 3 points on the plane

- Paramteric
- Sphere example

- Implicit

- Triangles
- Area as determinant

**Lecture 5**
Mon Mar 17th

Reading: Shirley Chapter 2 (completed this chapter today)

- Barycentric
Coordinates
- Basic formulation
- Usage
- Computing
B-coords
- through solving a linear system
- through signed scaled distance
- through ratio of triangle areas

- 3D
- computing B-coords by area ratio

**Lecture 6,7,8**
Wed Mar 19, Mon Mar 24, Wed Mar 26

**Reading:** *Required: *Chapter 5 of Shirley. Also review Chapter 4
for Linear Algebra Concepts

*Recommended: *4.6 to 4.8 of Angel. Also areally good reference on transformations
is Chapter 5 (2D Transformations) and Chapter 11 (3D Transformations) of Hearn
and Baker (on reserve in library)

**Useful Weblinks:**

2D tranformations applets: Link
1, Link
2, Link
3,

This 2D
applet should completely convince you about the order being important!

3D transformations:
This link
has a nice applet where you can specify any sequence of transformations in 3D
and view the result

- 2D Transformations
- Rotation
- Scaling
- Reflection
- Translation

- Homogeneous Coordinates
- Concatenation
of Transformations
- Order of Transformations
- Rotate/Scale followed by Translation
- Translation followed by Rotate/Scale
- Special cases in which order is not important

- 2D Rotation about an arbitrary point
- Inverse transformations
- Decomposition
of 2D transformations
- Eigen decomposition (see also Shirley 4.2.6)
- SVD and its interpretation (see also Shirley 4.2.7)
- Interpretation of Eigen vectors
- Decomposing a rotation about origin into three shears

- 3D Transformations
- Scaling
- Translation
- Rotations
around principle axes in right-handed coordinate system
- About z-axis
- About x-axis
- About y-axis

- Rotation
about arbitrary axis
- Aligned with principle axes (3 steps)
- Not-Aligned with principle axes (5 steps)
- Rotation through use of orthonormal property

- Transforming Normal Vectors
- Coordinate Transformation

**Lecture 9-10**:
Mon Mar 31, Wed Apr 2

**Required Reading**: [Shirley] 3.1 to 3.5, [FvDFH] 3.1-3.4 contains good
description of the mid-point algorithm

- Scan Converting
Lines
- Simple Scheme, its problems
- Incremental variation
- Midpoint Algorithm for Lines
- Incremental Midpoint Algorithm

- Scan Converting
Circles
- Eight way Symmetry
- Expensive implicit and polar algorithm
- Midpoint Algorithm
- Using incremental technique again to get rid of multiplications

- Scan Converting Ellipses
- Additional Issues
- Relation of slope to perceived intensity
- Anti Aliasing

**Lecture 11-12**:
Mon Apr 7, Wed Apr 9

**Required Reading**: [Shirley] Chapter 3 (Complete), [FvDFH] 3.9, [Baker]
Sec 3.11

Midterm Exam
in Lecture 12 (9th Apr)

The applets I showed
in class were from this
website.

This site also has other instructive applets, for lines
and for circles.

- Clarified confusion about 3D rotations
- Filling (From
[Baker])
- Parity Filling
- Recursive
Filling Algorithms
- Boundary Fill
- Flood Fill
- Reducing number of stack calls
- 4- vs 8-connectivity

- Drawing Thick
Primitives (From [FvDFH])
- Row/Column Replication
- Moving Pen
- Filling between Boundaries

- Scan Converting
Triangles (From [Shirley])
- Gouraud Shading (using Barycentric Coordinates)
- Problems with Shared Edges

**Lecture 13:**
Viewing: Monday Apr 14

Required Reading: [Shirley] Ch 6, [Angel] 5.1 to 5.4

- Basic Projection Terminology
- Taxonomy of Planar Geometric Projections
- Canonical View to Image Transformation
- Orthographic
Projection
- Camera Aligned with Principle Axes
- Camera in Arbitrary Orientation

- Perspective Projection

**Lecture 14:**
OpenGL: Wednesday Apr 16th

Required Reading: Understand the programs posted in the common folder, lecture
slides,

**Links:**

- What is OpenGL? Where to get it? http://www.opengl.org/users/about/index.html

- OpenGL overview, tutorials: http://www.opengl.org/developers/
and http://nehe.gamedev.net/

- GLUT documentation links: http://www.opengl.org/developers/documentation/glut/

- GLUT Tutorials: http://www.lighthouse3d.com/opengl/glut/

**Reference:**

- For commands reference for OpenGL, use your msdn help installed with Visual
Studio. All commands are referenced there. In case you are working on a machine
that does not have msdn help installed, you can use the following online link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/openglstart_9uw5.asp

- glut_man_pages.pdf
\Graphics Resources folder on \\badar\Common\cs352. This is a reference of all
GLUT commands.

**Useful files
posted in the \\badar\Common\cs352 folder:**

- Course
notes of a SIGGRAPH course on OpenGL are available in \Graphics Resources\Intro
to OpenGL

- Nate Robbins tutorials (shown in class) are in \Graphics Resources\TUTORS
folder.

- Slides of this lecture are in \Handouts folder

- Programs shown in class are in \Graphics Resources\demoPrograms. Play with
these to get a feel of the programs.

**Program 4:**

This programming assignment will be worth twice the weight of the others that
we have done. The game that you have to implement for Program 4 is "Block
Out" in the \blocks folder in \\badar\Common\cs352. You only have to implement
the flat blockset, do not have to do slow rotations, only 3x3x12 pit needs to
be implemented. Practice mode and demo mode are also not necessary to implement.
You do need to have scores, and multiple levels. You do need to implement 6
types of rotations (c-wise and cc-wise on each axis), arrow keys for translation.
Space bar for for fast drop is optional. Additional blocksets, pit-sizes, sounds,
slow-rotations, other features may be tried for fun. Final due date is Monday
5th May, but a design document is due this Friday. More details on this later...

**Lecture 15:
**OpenGL/Programming Tips: Mon Apr 21

Details of Programming Assignment are posted on the assignments page

Lecture Slides and Programs shown in class are posted in the Common Folder. You should understand each program completely. You may be tested on variations of these programs in an exam or a quiz. You should also cover all the material in the lecture slides... It may be a good idea to look at the help of the functions discussed from msdn help, and practice using them in a program.

Design document for programming assignment is due this Friday.

**Lecture 16:**
Hidden Surface Elimination: Wed Apr 23

Required Reading: [Shirley] Chapter 7, [Angel] Sec 5.6

**Useful Link:**
BSP Tree Applet: http://symbolcraft.com/graphics/bsp/index.html

- Object Space Methods vs. Image Space Methods
- Culling (Back Face Elimination)
- Painter's Algorithm
- BSP Tree
- Computation
- Traversal
- Splitting Triangles

- Perspective Transform with Depth (Derivation of equations in [Shirley] 6.3)
- Z Buffer
- Integer Z-Buffer

**Lecture 17:**
Lighting: Mon Apr 28

Required Reading: [Shirley] Chapter 8, [Angel] 6.1-6.5

**Useful Link**:
Light Models Applet: http://www.siggraph.org/education/materials/HyperGraph/illumin/vrml/pellucid.html

- Directional Light Source
- Lambertian (Diffuse) Model
- Ambient Light
- Phong Shading
Model
- Computing direction of reflection
- Use of half-way vector

- Interpolation
- Flat Shading
- Gouraud Interpolation
- Interpolating Normal Vectors (Phong Interpolation)

- Intensity Attenuation Model
- OpenGL Lighting
Model (not in book)
- Spot Lights
- Emission from Surface

**Lecture 18:**
Clipping/Project: Wed Apr 30

Required Reading: [Baker] 6.5, 6.6, 6.7 (Skip Liang-Barsky and Nicholl-Lee-Nicholl),
6.8

Optional Reading: [Shirley] Chapter 11

Lecture notes are available in J:\Handouts folder

- Graphics Pipeline
- Clipping
- Point Clipping
- Line Clipping
- Trivial Accepts and Rejects
- Cohen-Sutherland
Line Clipping
- Outcodes
- Computing Intersections
- MidPoint Subdivision
- 3D extension

- Polygon
Clipping
- Sutherland-Hodgeman
Polygon Clipping
- Clipping against one edge at a time
- Rules for discarding vertices

- Weiler-Artherton Polygon Clipping

- Sutherland-Hodgeman
Polygon Clipping

**Lecture 19:
Texture Mapping:** Monday May 5

Required Reading: [Angel] 7.5, 7.6

- 2D Textures
- Texels
- Transformations
- Texture Space
- PreImage
- Pixel Space

- Warping
- Projective Transformation

- Interpolation
Strategy
- Nearest Neighbor
- Bilinear Interpolation

- Example: Cylindrical Mapping
- Bump Maps
- Equations

- Displacement Mapping

**Lecture 20:
Curves**, Wed May 7

Required Reading: [Shirley] 13.1 to 13.4

- Texture Mapping
in OpenGL
- Texture Coordinates
- Aliasing
- MipMaps
- Texture Wrap

- Quadratic Bezier
Curves
- Subdivision
- Derivation
- Control Points

- Nth Order Bezier Curves
- Properties