W Randolph Franklin home page
... (old version)
ComputerGraphicsFall2011/ home page Login


This is a summary of the lectures from ECSE-4750 Computer Graphics, Rensselaer Polytechnic Institute, Fall 2011. It is intended to be easier to read than the separate Piazza entries. It is also available for indexing and searching.

I will add links to any handwritten notes later. Until then you can use the links in the piazza entries.

Quick links

Loading...

Week 1

Wed 8/31 (L1)

  1. Discuss syllabus
  2. Introduce piazza.
  3. Show
    1. John Cleese PC ad
    2. History of Computer Animation - P1
  4. Show simple OpenGL program, square.cpp, from the code zipfile on the publisher site.

Thurs 9/1 (L2)

  1. Notes written on the viewgraph are here. However you had to be there to really understand them.
  2. We dissected our initial OpenGL program: square.cpp, to understand every line. We made many small mods, recompiled and executed it.
    square.cpp is in the code zipfile on Guha's web site.
  3. We saw part 2 of the history of graphics.

Week 2

Wed 9/7 (L3)

Handwritten notes

Linear algebra tutorial

  1. For students confused by the linear algebra questions, the following may help:
    1. vector methods.
    2. Vector Math for 3D Computer Graphics
    3. Working with vectors, from Maths: A Student's Survival Guide
  2. Also see wikipedia.
  3. Some older graphics texts have appendices summarizing the relevant linear algebra.
  4. The scalar (dot) product is needed to do things like this:
    1. compute how a ball bounces off a wall in pong
    2. compute lighting effects (how light reflects from a surface)
  5. The cross product's applications are mostly in engineering, e.g., to compute torque and angular momentum.
  6. The triple product (A.BxC) computes the volume of a parallelepiped.

Thurs 9/8 (L4)

  1. Handwritten notes during lecture.
  2. hemisphere.cpp shows
    1. rotation and translation
    2. perspective projection
    We'll study these in great detail later. Each new transformation concatenates onto the modelview matrix. When you plot a vertex, the current modelview matrix transforms it. The last transformation concatenated onto the modelview matrix is the first applied to the vertex.
  3. circularannuluses.cpp introduces the depth (or Z) buffer. With it, the nearest object on each pixel is displayed. W/o it, the last object drawn into each pixel is displayed.
  4. squareannulus*.cpp show more efficient ways to plot lots of vertices.

Week 3

Mon 9/12 (L5)

On Wed, just a lab for people to get final help on the homework.

Today:

  1. squareAnnulusAndTriangle, p 69: interspersed vertex and color data
  2. helixList.cpp:
    1. display list
    2. push and pop transformation
  3. multipleLists.cpp: multiple display lists
  4. fonts.cpp, p 72: bitmapped and stroke fonts
  5. mouse.cpp: mouse button callback
  6. mouseMotion.cpp: mouse motion callback
  7. moveSphere.cpp, p 76: non# ASCII key callback

Wed 9/14

Today is a lab to get help for homework 1.

Thurs 9/16 (L6)

  1. Videos
    1. SIGGRAPH 2011 Technical Papers Video Preview
    2. Most Realistic Computer Graphics - NVIDIA human head demo
    3. SIGGRAPH 2011 Computer Animation Festival Video Preview
  2. Programs
    1. menus.cpp - p 77
    2. lineStipple.cpp - p 77
    3. canvas.cpp - p 78
    4. glutObjects.cpp - p 80
    5. clippingPlanes.cpp - p 82
    6. viewports.cpp - p 86
    7. windows.cpp - p 87

Week 4

Makefile

  LDLIBS=-lglut -lGLEW -lGLU -lX11 

Mon 9/19 (L7)

  1. Video
    1. Evans and Sutherland flight simulator history
  2. Programs
    1. reviewed the attached modified simple drawing program canvas2.cpp
    2. new programs from the book:
      1. glutObjects.cpp
        1. 9 builtin glut polyhedra
        2. initial look at lighting in OpenGL; we'll see this a lot more
    3. clippingplanes.cpp: add more clip planes to the 6 original ones (the sides of the view volunme)
    4. viewports.cpp: change the viewport and draw more stuff
    5. windows.cpp: multiple top level windows, each with its own callbacks
  3. Next Mon, we start chapter 4; so feel free to read ahead. We'll see the mathematics of transformations. Each of the major transformations (translation, rotation, scaling, projection) can be expressed as a multiplication with a 4x4 matrix.

Wed 9/21

A lab only for homework questions.

Thurs 9/23

No lecture.

Visible human

A few days ago I mentioned the Visible Human project, where a male and a female corpse were sectioned and scanned. This is the site.

Googling will produce other info about it.

Week 5

Mon 9/26 (L8)

  1. Videos
    1. RealFlow Siggraph 2011 Showreel
    2. Animating Fire with Sound (SIGGRAPH 2011)
    3. Layered 3D: Tomographic Image Synthesis for Attenuation-based Light Field and HDR Displays
    4. Physics demos Show off Fog at NVIDIA GTC keynote day 1
  2. Topics today
    1. box.cc, p. 92, with lots of the mods
    2. section 4.2 Composing Modeling Transformations

Wed 9/28

A lab to get help from TAs on the homework.

Thurs 9/29 (L9)

  1. Videos:
    1. TED: Paul Debevec animates a photo-real digital face
    2. TED: Ed Ulbrich: How Benjamin Button got his face
  2. New Material: Guha, starting at page 114
  3. New ideas
    1. translation as a 4x4 matrix multiply
    2. animate by setting an idle callback or a timer callback
  4. Programs
    1. composeTransformations.cpp
    2. box.cpp with blocks 10 and 13 inserted (separately, not both at once)
    3. rotatingHelix{1,2,3}.cpp
  5. Handwritten notes during lecture

Week 6

Mon 10/3 (L10)

  1. Video
    1. TED: David Bolinsky animates a cell
  2. Code
    1. ballAndTorus.cpp, p 120
  3. experiment 4.20, p 122
  4. ballAndTorusWithFriction.cpp, p 124
  5. clown head, p 125
  6. flowerintPoint.cpp, p 129
  7. viewing transformation, p 133
  8. spaceTravel1.cpp, p 153

Wed 10/5

This lab is just a chance to ask homework questions.

Thurs 10/6 (L11)

  1. Steve Jobs
    1. Steve Jobs talks about managing people
    2. Steve Jobs explains the rules for success
    3. Steve Jobs Funniest Joke. Even Bill Gates Laughs
    4. 1984 Apple's Macintosh Commercial
    5. Everyone likes Apple Computers, even Bill Gates
    6. Steve Jobs' 2005 Stanford Commencement Address
  2. Code
    1. animateMan1.cpp etc, p 157
    2. ballAndTorusShadowed.cpp, p 161
    3. selection.cpp, p 163
  3. 10/13 Exam
    1. Open book, open notes
    2. Questions based on the programs and material covered in class
    3. I'll be at the Wed lab to answer questions.

Week 7

Tues 10/11 (L12)

  1. Videos: Siggraph 2009 stuff
  2. Code: picking and selection
  3. Handwritten notes: here.

Wed 10/12

review before exam

Thurs 10/13

Midterm exam

  1. open book, open notes, no computers

Week 8

Mon 10/17 (L13)

Broader impact of the 36 graphics programs that we've studied

Beyond the specifics of OpenGL, they show one way to design an interactive graphics API. The ideas that you've seen - event loop, transformations, viewing, etc - occur in any graphics system.

Term Project

See here.

The proposal was due this Thurs, but you can submit it on next Tues.

Size of term project: It's impossible to specify how many lines of code makes a good term project. E.g., I take pride in writing code that is can be simultaneously shorter, more robust, and faster than some others. See my 8-line program for testing whether a point is in a polygon here.

  1. According to Big Blues, when Bill Gates was collaborating with IBM around 1980, he once rewrote a code fragment to be shorter. However, according to the IBM metric, number of lines of code produced, he had just caused that unit to officially do negative work.
  2. Some winners of ''The International Obfuscated C Code Contest (IOCCC)'', http://www.ioccc.org/, implement graphics projects in amazingly short programs. My local cache is here: ioccc/. Note the beautiful formatting of many programs.
    1. gavare.c is a 28 line ray-tracing program producing this: gavare.jpg (as a pnm file).
    2. vik1.c is a 63 line interactive color auto racing program.
    3. banks.c is a 60 line interactive flight simulator.
    4. eldby.c is a 8 line flying spheres program. However its graphics is pretty primitive.
    5. williams.c is a 73 line missile command game.
    6. dodsond1.c is a 72 line Othello game, which beats me.
    7. buzzard.c is a 31 line 1st person maze walker with perspective display.
    8. tvr.c is a 115 line interactive fractal program that puts up 2 X windows.

New material

We now switch to more math and less programming. We'll do it a little differently from Guha.

  1. Transformation review
    1. Each type of common transformation (translate, rotate, scale, project) is a matrix.
    2. If applying several transformations, it is faster to first multiply the matrices, then just multiply all the points by that one matrix.
    3. Most OpenGl transformation routines modify one of two current transformation matrices: the modelview or the projection.
    4. The modelview matrix moves the world so that the camera is where you want it, relative to the objects. Unless you did a scale, the transformation is rigid - it preserves distances (and therefore also angles).
    5. The projection matrix view-normalizes the world to effect your desired projection and clipping. For a perspective projection, it does not preserve distances or angles, but does preserve straight lines. We'll cover this later.
    6. The last transformation catenated onto the current matrix is the first transformation applied to the object.
    7. OpenGL combines the two matrices, so the modelview matrix is applied first to the object.
  2. Rotations: My note on 3D rotation
    1. all rigid transformations in 3D that don't move the origin have a line of fixed points, i.e., an axis, that they rotate around.
    2. deriving the vector formula for a rotation given the axis and angle
    3. computing the matrix from a rotation axis and angle
    4. testing whether a matrix is a rotation
    5. if it is, then finding the axis and angle

Photos of what I wrote on the viewgraph.

Thurs 10/20 (L14)

  1. Quaternions. This is an alternative method to rotate in 3D. Its advantages are:
    1. It starts from the intuitive axis-angle API.
    2. Animating a large rotation in small steps (by varying the angle slowly) is easy. In contrast, stepping the 3 Euler angles does not work well, and there's no obvious way to gradually apply a {$3\times3$} rotation matrix, {$M$}. (You could compute {$M^{1/100}$} and apply it 100 times, but that computation is messy.)
    3. When combining multiple rotations, the axis and angle of the combo is easy to find.
    4. Having only 4 parameters to represent the 3 degrees of freedom of a 3D rotation is the right number. Using only 3 parameters, as Euler angles do, causes gimbal lock. That is, you cannot always represent a smooth rotation by smooth changes of the 3 parameters. OTOH, using 9 parameters, as with a matrix, gives too much opportunity for roundoff errors causing the matrix not to be exactly a rotation. (You can snap the matrix back to a rotation matrix, but that's messy.)
  2. Photos of what I wrote on the viewgraph.

Forbes compares Engineering and Economics

http://www.forbes.com/sites/billfrezza/2011/10/18/the-fundamental-fallacies-of-macroeconomics/

Do you sometimes wonder why economists are accorded such respect and influence given the fact that they claim knowledge over the unknowable, promote theories that are untestable, and make forecasts for which they are never held accountable? Isn't that the definition of a witch doctor?

If engineers were held to the same standards, bridges would collapse as often as banks, planes would fall from the sky (if they ever got off the ground), and cyclical blackouts would be a permanent feature of our electrical grid. But at least they would get to visit the White House.

Have you ever watched engineers from different schools argue on Sunday morning talk shows about the validity of Bernoulli's Principle or Ohm's Law? No? Yet economists, like rival witch doctors, get red in the face promoting diametrically opposed economic remedies, sometimes sharing Nobel Prizes in the same year for theories that directly contradict each other. Take $2 trillion and call me in the morning.

Week 9

Possible spring courses

For students who want lots of graphics. These courses won't overlap.

  1. CSCI-4530/6490 ADVANCED COMPUTER GRAPHICS, T F 2:00 3:50PM Cutler
    See the description in piazza (I'll copy it over here later.)
  2. CSCI-4973-01 INTRO TO VISUALIZATION W 10:00 11:50AM Cutler
  3. ECSE-6800 ADVANCED 3D COMPUTER GRAPHICS AND VIZ, M R 4-5:20 Franklin
    This course will spend a month each on 4 topics related to advanced graphics.
    1. Computational geometry, incl CGAL
    2. Computer Aided Design
    3. GIS, incl GRASS
    4. Graphics HW, incl programming in CUDA

Mon 10/24 (L15)

  1. Videos
    1. http://www.youtube.com/watch?v=rrUCBOlJdt4&feature=related Gimble Lock - Explained
  2. View normalization or projection normalization
    1. We want to view the object with our desired perspective projection.
    2. To do this, we transform the object into another object that looks like an amusement park fun house (all the angles and lengths are distorted).
    3. However, the default parallel projection of this normalized object gives exactly the same result as our desired perspective projection of the original object.
    4. Therefore, we can always clip against a 2x2x2 cube, and project thus: (x,y,z)->(x,y,0) etc.
  3. Copy of what I wrote on the tablet.

Wed 10/26

A lab to resolve grades.

Thurs 10/27 (L16)

  1. Homework 6 is out.
  2. Homogeneous coordinates
    This is today's big idea
    HomogeneousCoords
  3. Lighting

This is the next topic. To prepare, read Guha, Section VI, pages 403-524. (You don't have to read all of it for Mon.)

Things I added to lecture, which are not in the book:

  1. Tetrachromacy
  2. metamers
  3. CIE chromaticity diagram
  4. Job ad: Database Programmer
    "We are seeking at least one undergraduate or master's student in the database area. The ideal candidate will have completed at least one undergraduate course in database systems. Good written and oral communication skills are a plus. This position provides an opportunity to work within the EMPAC facility, and to support demos and user studies with emergency response personnel in the Albany region. The position would begin immediately, and would involve approximately 10 to 15 hours of work per week during the semester, with an option for further time during summer. Compensation is competitive. If interested, please send a short memo describing your experience to Professor David Mendonça (mendod@rpi.edu). "
  5. Copy of what I wrote on the tablet.

Week 10

Mon 10/31

  1. Continue lighting, mostly following Guha.
  2. Copy of what I wrote on the tablet.

Wed 11/2

A lab to discuss homework 6.

Thurs 11/3

No class.

Homework 7 online, due next Thurs.

Week 11

Mon 11/7

  1. Quick review of the Phong lighting model. The total light at a pixel is the sum of
    1. Incoming ambient light times ambient reflectivity of the material at the pixel,
    2. Incoming diffuse light times diffuse reflectivity times a factor for the light source being low on the horizon,
    3. Incoming specular light times specular reflectivity times a factor for the eye not being aligned to the reflection vector, with an exponent for the material shininess,
    4. Light emitted by the material.
    See page 439.
  2. That is not intended to be completely physical, but to give the programmer lots of parameters to tweak.
  3. OpenGL has several possible levels of shading. Going down the list makes the shading better but costlier.
    1. Shade the whole polygon to be the color that you specified for one of the vertices.
    2. Bilinearly shade the polygon, triangle by triangle, from the colors you specified for its vertices.
    3. Use the Phong lighting model to compute the color of each vertex from that vertex's normal. Bilinearly interpolate that color over the polygon. That is called Gouraud shading.
    4. Bilinearly interpolate a surface normal at each pixel from normals that you specified at each vertex. Then normalize the length of each interpolated normal vector. Evaluate the Phong lighting model at each pixel from the interpolated normal. That is called Phong shading.
  4. Computing surface normals. See page 442ff.
    1. For a curved surface, the normal vector at a point on the surface is the cross product of two tangent vectors at that point. They must not be parallel to each other.
    2. If it's a parametric surface, partial derivatives are tangent vectors.
    3. A mesh is a common way to approximate a complicated surface.
    4. For a mesh of flat (planar) pieces (facets):
      1. Find the normal to each facet.
      2. Average the normals of the facets around each vertex to get a normal vector at each vertex.
      3. Apply Phong (or Gouraud) shading from those vertex normals.
  5. Texture, chapter 12, pages 467ff.
  6. fieldAndSky.cpp
  7. texturedTorus.cpp
  8. Copy of what I wrote on the tablet.

Wed 11/9

  1. This is a regular lecture to replace last Thursday's cancelled lecture.
  2. We continue to study textures. Important topics:
    1. Texels vx pixels.
    2. Minification and magnification.
    3. GL_NEAREST, GL_LINEAR, etc.
    4. Aliasing.
    5. Mipmapping.
    6. GL_LINEAR_MIPMAP_LINEAR etc.
  3. fieldAndSkyFiltered.cpp
  4. compareFilters.cpp
  5. mipmapLevels.cpp
  6. buzzwords: LOD (Level Of Detail), multiresolution.
  7. texturedTorpedo.cpp That uses evaluators and Bezier patches, which we'll see in detail later. However, for now, to understand it, see
    1. Rendering Grids with OpenGL Evaluators
    2. editgrid.c
    3. bezmesh.c
  8. fieldandSkyLit.cpp
  9. litTexturedCylinder.cpp
  10. Copy of what I wrote on the tablet.

Thurs 11/10

Regular lecture: Chapter 13, Special Visual Techniques.

Week 12

Mon 11/14

  1. Finish chapter 13:
    1. Stencils: When drawing, update frame buffer only where pixel stencil is set.
    2. Bump mapping: Perturb normal of smooth surface before computing lighting, to simulate small details.
  2. Copy of what I wrote on the tablet.

Thurs 11/17

  1. Chapter 14, p 527: Raster algorithms
    1. Cohen-Sutherland line clipping
    2. Sutherland-Hodgman polygon clipping
    3. Bresenham line drawing
    4. Polygon rasterizing: 2 methods.
  2. Bresenham
    1. Bresenham's current import is how it made an algorithm more efficient by changing how you look at the problem. It efficiently drew lines and circles mostly using only integer addition - no floating ops and no multiplication or division inside the loop.
    2. Bresenham presents the fast line and circle drawing algorithms better than the text.
  3. For more info on testing whether a point is in a polygon, see my note. Also see the comp.graphics.algorithms FAQ, question 2.03.
  4. The flood fill will fail if the interior is not connected. That happens when two close edges cause adjacent pixels to be set. It will also fail if there is a gap in the perimeter - the color will leak out.
  5. The scan line fill must handle special cases like a vertex being on a scan line. My solution is to pretend that any vertex on a scan line is really slightly above. This is a simple case of a serious technique called ''Simulation of Simplicity'' invented by Herbert Edelsbrunner.
  6. Copy of what I wrote on the tablet.

Week 13

Mon 11/21

  1. Thanksgiving trivia questions:
    1. What language did Samoset, the first Indian to greet the Pilgrims, in 1621, use?
      Answer: http://www.holidays.net/thanksgiving/pilgrims.htm
    2. How many European countries had Squanto, the 2nd Indian to greet the
    Pilgrims, visited?
  2. Chapter 19, page 675: Fixed Functionality Pipelines: We'll skip this (for now), and cover it later or in the spring.
  3. Chapter 20, page 723: Programmable Pipelines.
  4. Copy of what I wrote on the tablet.

Thu 11/25

No lecture. Optional reading material:

  1. SIGGRAPH 91 and 92 preliminary programs. This is a bowdlerized version, from whence I have removed items that might give offense.
  2. Raytracing jello brand gelatin

Week 14

Mon 11/28

EMPAC tour led by Eric Ameres

Thu 12/1

More shader examples. These are from the 4th edition of the OpenGL Superbible. The local copy of the code is here. The code is arranged in two parallel trees: src has the C++ source code, while projects has the Makefile, executable, and shader files. Some interesting examples are:

  1. chapt16/vertexshaders
  2. chapt17/fragmentshaders
  3. chapt17/imageproc
  4. chapt17/lighting
  5. chapt17/proctex

Week 15

Mon 12/5

  1. Curves and spline intro
  2. Reference: Guha, chapter 15.
  3. My tutorial on Bezier curves.
  4. Video of Sebastian Thrun's keynote talk at last year's NVidia technical conference. (This is a baseline of a good term project, given that Thrun was hampered by being at Stanford not RPI.) (Local cache).
    What really causes accidents and congestion on our roadways? How close are we to fully autonomous cars? In his keynote address, Stanford Professor and Google Distinguished Engineer, Dr. Sebastian Thrun, will show how his two autonomous vehicles, Stanley (DARPA Grand Challenge winner), and Junior (2nd Place in the DARPA Urban Challenge) demonstrate how close yet how far away we are to fully autonomous cars. Using computer vision combined with lasers, radars, GPS sensors, gyros, accelerometers, and wheel velocity, the vehicle control systems are able to perceive and plan the routes to safely navigate Stanley and Junior through the courses. However, these closed courses are a far cry from everyday driving. Find out what the team will do next to get one step closer to the holy grail of computer vision, and a huge leap forward toward the concept of fully autonomous vehicles.
  5. Copy of what I wrote on the tablet.

Wed 12/7

Fast forward presentations

Thu 12/8

Fast forward presentations

Week 16

Mon 12/12

  1. Review
  2. Office hours this week:
    1. Tues 1-2pm, Yang Li. JEC 6037. Good time to demo projects.
    2. Wed, 4-5:30, Qi Wu.
  3. Copy of what I wrote on the tablet.

Thurs 12/15

Final exam, DCC330, 3-6 pm.

Solution.

From the syllabus:

You may bring in any printed material, but no computers. You may not share the material with each other during the exam. No collaboration or communication (except with the staff) is allowed. The final exam will contain material from the whole course, but more from the last half.

  1. Fall 2010, Solution.
  2. Fall 2009, Solution.
  3. Fall 2008
  4. Fall 2007
  5. Fall 2006
  6. Fall 2005
  7. Fall 2005 sample questions
  8. Spring 2005

Week 17

Mon Dec 19

Total grade stats

Cutoff	QPA	Letter	Count
0	0	FF	0
48.5	1	DD	1
53.5	1.3	DP	0
58.5	1.7	CM	0
63.5	2	CC	1
68.5	2.3	CP	1
73.5	2.7	BM	2
78.5	3	BB	11
83.5	3.3	BP	16
88.5	3.7	AM	16
93.5	4	AA	7

Class QPA = 3.34

Because the class impressed me so much, I eased the cutoffs somewhat from what was in the syllabus.

Ending notes

  1. Comments and sugggestions for improving the course are welcome.
  2. Even when you're not taking a course from me and even after you graduate, feel free to write or phone with questions are comments about things in general, and to tell me what you're doing.