CS 365 at Valparaiso University
Spring, 2004
Michael Glass
HW 6 revised and corrected writeup
4/28.
Here is the syllabus.
CS 365 is a class in computer graphics, combining study of
computer graphics data structures and algorithms and the
use of the OpenGL package.
On this web page you can find the topics we covered in each
class, plus miscellaneous notes, handouts, and assignments.
| Textbook: |
Peter Shirley, Fundamentals of Computer Graphics,
2002 |
Class log is incomplete. I am in the process of updating it
- Week of April 19-23
- More on Bezier curves (Ch 13), developing the equation by
approximating by cutting off corners successively.
- Control points, higher order curves
- Bezier curve though of as the sum of a bunch of functions,
one for each control point, that sum to 1.
- Bezier patches, a combination of two Bezier curves
- Why Bezier patches are useful for geographic meshes such
as HW6.
- I did not get OpenGL patches working, so it is cancelled from
HW6.
- Here is HW 6 writeup.
- Here are the
three HW 6 data sets as a zip file. (The
Honolulu and New Mexico data sets come from Edward Angel,
University of New Mexico, who uses them for a similar
assignment in his own graphics class.) These data sets are
available on the Sun cluster as
honolulu.txt,
nmtopo.txt, and objects.txt in
/home/mglass/cs365
- Week of April 12-16
- Graphics pipeline is unobvious because some operations
are best conceptualized as moving forward from the original
model to the picture (e.g. movement and perspective transformations)
and some as moving backward from the pixels to the model
(e.g. computing color based on vector between pixel and
model surface, mapping texture pixels onto raster pixels,
gamma correction, and anti-aliasing).
- Cohen-Sutherland clipping
- Z-buffer is a powerful technique because it transforms
an apparently model-level decision (hidden surface removal)
into a pixel-level decision that happens at the end of the
pipeline.
- Chapter 13: specifying curves and surfaces parametrically
- Bilinear patches
- Idea behind Bezier curve between 3 points.
- Intro to HW 6: mapping of topographic data with a surface mesh
- Geographic coordinates are in the x-z plane, height is along
the y-axis.
- Mesh is formed from quads or quad strip, draw borders.
Mesh must be opaque (it is not a wire frame, you can't see through
the mountain).
- Lighting and z-buffer are needed
- glMaterial needed for specifying color
- Week of April 5-9
- Another visual effects you need to be aware of: Mach bands
- Lateral inhibition again
- Texture mapping in OpenGL: load texmap with glTexImage2D,
enable GL_TEXTURES, use glTexParameter to set texture behavior,
specify (u,v) texmap coordinate for each vertex within the
glBegin/glEnd block.
- Generally how pixel maps are stored in OpenGL
- Bump shading is a way to simulate a rough surface by adding
3-D randomness to a 2-D texture. This is useful because a
rough surface shows shadows depending on the lighting position,
while a wallpaper picture of a rough surface does not.
- Graphics pipeline (Chapter 11) the rough order in which
operations occur.
- OpenGL has two parallel pipelines, one for pixel data one
for modeled objects.
- Clipping, clipping planes.
- Several places in the pipeline that clipping can happen, why
clipping is easier before z is distorted by homogenization.
- Week of March 29-April 2
- Lot of HW3 issues
- Textures (Chapter 10)
- 2-D and 3-D textures
- Textures used not only for surface textures, also to put
grass in a picture for example.
- 2-D textures as bit maps: texmap
- Four coordinate systems simultaneously: (u,v) within texture map,
coordinates of the polygon you are rendering, world coordinates,
raster coordinates
- Texture map will be tesselated onto polygonal surfaces of object,
distorted by object.
- Texmap pixels probably will not line up with raster pixels, a lot
of messy technqiues are needed to avoid problems such as Moire patterns.
- Bilinear interpolation of texture pixels onto raster pixels.
- Downsampling and averaging to reduce texmap granularity
(what OpenGL calls mipmaps) to approximately match raster granularity.
- Moire patterns illustrated.
- Week of March 22-26
- Ray tracing: ray triangle intersection computation
- Deciding what objects were hit: bounding boxes, intersection
of rays with same.
- The idea of BSP trees, binary trees where overlapping
objects can appear in several subtrees, why this is still
logarithmic search time, simple example using packed orange
crates.
- Sublinear ray tracing: several rays through each pixel
- Stratified sampling.
- Using ray tracing to simulate non-point light sources and penumbras.
- Using ray tracing to simulate a focal plane, where objects
farther or nearer than the focal plane are not in perfect focus.
- HW5 Writeup: transformation matrices on triangles.
You can reuse a lot of HW1 code. The idea here is to practice
2-D transformations in homogeneous coordinates.
- Week of March 15-19
- Finish Chapter 8 (lighting)
- More on OpenGL lighting model
- Averaging surface over surface polygons
- Purpose of ray tracing (Chapter 9): simulating
depth effects (instead of using a z-buffer), simulating
lighting effects such as shadows, refraction, and multiple
reflections within one image, that are not well-modeled
by the simple light + surface normal calculation.
- Part of ray tracing is computed backward, the start at
the eye point and run through the mid-pixel points on the
display raster until a surface is encountered.
- Also rays are computed forward from the light source.
This is how refraction is handled for transparent and translucent
objects, where some fraction of the undergoes specular reflection
and some refracts at a different angle through the material.
- Fresnel equation: how much reflects off and how much refracts
through depends on incident angle.
- Wednesday, Feb 25
- HW 4 issues.
- OpenGL specifying materials: glMaterialfv() for specular color,
Phong exponent, ambient and diffuse color, emission.
- OpenGL specifying lighting model: glLightingModel() for ambient
light, infinitely distant viewer vs. eye-location viewer.
- Examples of some lighting phenomena.
- Monday, Feb 23
- Phong lighting finished: surface normal, light vector, reflection vector,
eye vector, half-vector, exponent.
- Specular reflection usually does not depend on color of surface.
- Diffuse reflection
- Grand lighting equation: ambient, diffuse, and specular combined.
- Lateral inhibition in vision, edge enhancement
- On piecewise-polygon surface, surface normals can be interpolated.
- OpenGL allows you to assign surface normals to the edges and vertices.
- Friday, Feb 20
- HW 3 Due
- OpenGL: glPushMatrix(), glTranslate(), glRotate(), as a way to
conveniently draw objects as if they were at the origin.
- Types of light recognized by OpenGL: ambient, diffuse, flood, specular.
(Some of these are really properties of the surface, not the light, but
OpenGL allows the light source to have them.)
- Beginning of Phong lighting (Chapter 8)
- HW 4 Due Friday, Feb 27: Ch. 5 ex. 1,7; Ch. 6 ex. 1, 2; Ch. 7 ex. 2.
Ch. 6 ex 8 cancelled
- Wednesday, Feb 18
- Z-buffer discussion concluded.
- How to enable z-buffer in OpenGL and Glut.
- HW3 issues: drawing spheres (again)
- Types of light scattering surfaces (Chapter 8):
diffuse/matte, specular/shiny, translucent.
- Monday, Feb 16
- Chapter 6 and OpenGL big-picture review: model-view and projection
transformations.
- Z-buffer for hidden-surface removal introduced (Sec. 7.2)
- HW 3 issues: use of glMatrixMode, glLoadIdentity, etc.
- Friday, Feb 13
- HW 3 issues.
- More on perspective transformations (Sec. 6.3)
- Homogeneous coordinates, how they help
- Handy handouts: single-sheet reference cards for
C and
EMACS.
- Wednesday, Feb 11
- 3-D matrix transforms to move an orthographic view volume to
the canonical cube (Sec. 6.1-2).
- 3-D transforms to change a perspective view volume to an orthographic one.
(Sec. 6.3).
- Monday, Feb 9
- HW 3 assigned. (Feb 14 revision)
- Here are screenshots of the HW 3 helix,
hemisphere,
and moebius strip
- Complete set of glut callbacks needed for HW3 (display, reshape,
menu, keyboard, special key).
- Many OpenGL concepts and issues for HW3
- Briefly: 3-D matrix transforms similar to 2-D ones: rotations
about one axis, translation, scaling, shear.
- Friday, Feb 6
- HW3 screen shots and description (see Monday, Feb 9)
- OpenGL concepts needed for HW3: model-view and projection matrices,
projection transformation, viewport.
- Drawing a helix
- Wednesday, Feb 4
- HW 2 assigned, with associated graph paper
- Listing of my own C implementation for line drawing handed out.
- Translation of coordinates in 2-D using 3x3 matrices
- Viewing volume and clipping planes
- Monday, Feb 2
- More HW1 issues
- Drawing a sphere with GL_QUAD_STRIP
- Right-hand rule defines surface orientation
- OpenGL has two transformation matrices: model-view and projection
- Positions of the synthetic camera, film, and object
- Orthographic vs. regular projections
- Pinhole camera has infinite depth of field, lens camera (and
eyes with lenses) do not.
- Viewing volume and clipping planes
- Friday, Jan 30
- More review of line-drawing (people seem to have problems with this)
- HW 1 other issues: speedup
- OpenGL polygon drawing modes: GL_POINTS, GL_POLYGON, GL_QUADS, GL_TRIANGLES,
GL_QUAD_STRIP.
- Color-as-wavelength vs. RGB, color perception, metameric pairs
- Wednesday, Jan 28
- HW 1 issue: compiling and linking on various OSs
- HW 1 issue: review of line-drawing using implicit line
equations (Sec 3.5.1).
- Monday, Jan 26
- HW 1 issues
- More Sec 5.1 basic 2D transforms: rotations, composition
of transformations.
- Friday, Jan 23
- HW 1 issues:
idle loop (will be fixed next HW),
line drawing algorithms when delta Y > delta X, jaggies.
- Review of matrix multiplication
- Sec 5.1: basic 2D transforms started
- Wednesday, Jan 21
- HW 1 assigned.
- A hw1.zip file contains
the writeup, skeleton, and Sun compile script. You can obtain the
same files from
/home/mglass/cs365.
- Due date is Friday, Jan 30. Upload your C file to Coursevu for this class.
- You can try an example program on the Suns:
/home/mglass/cs365/hw1example &
- Friday, Jan 16
- Antilaising (Sec. 3.7)
- Rendering triangles (Sec. 3.6)
- Parametric formulations (Sec. 3.5)
- Color interpolation (Secs. 3.5 & 3.6)
- Wednesday, Jan 14
- Bresenham's algorithm for line-drawing with integers, no
multiplication and division. This is equivalent to the algorithm
in sec. 3.5.1, but it starts from slope-intercept thinking
instead of implicit function thinking.
- Here is an
explanation of same
- Monday, Jan 12
- Line rendering (sec. 3.5)
- Implicit function of a line (sec 2.5.2)
- Friday, Jan 9
- Barycentric Coodrinates (sec. 2.10)
- Intro to OpenGL, illustrated by this
example program.
- Wednesday, Jan 7
- Intro to the big idea: 3D model, synthetic camera.
- Graphics pipeline.
- Vocabulary: vectors, triangles, raster and rasterize, pixel,
RGB/RGBA, alpha (opacity), additive and subtractive colors,
wireframe, hidden lines, gamma (monitor characteristic). (Most from
sec. 3.1 - 3.3)
Last update: 28 March 2004
Michael Glass