# Quick links

- Course home page
- Lectures, summarized on one page.
- Google calendar.
- textbook.
- Programs I modified in class.

**Contents** (hide)

- 1. Mon 8/27 (L1)
- 2. Wed 8/29
- 3. Thu 8/30 (L2)
- 4. Linear algebra tutorial
- 5. Thu 9/6 (L3)
- 6. Lecture and lab swaps
- 7. Mon 9/10 (L4)
- 8. Wed 9/12 (L5)
- 9. Thu 9/13 (L6)
- 10. Mon 9/17
- 11. Wed 9/19
- 12. Thu 9/20
- 13. Mon 9/24 (L7)
- 14. Wed 9/26
- 15. Thu 9/27 (L8)
- 16. Mon 10/1 (L9)
- 17. Wed 10/3 (L10) Regular lecture
- 18. Thu 10/4 (L11)
- 19. Tues 10/9 (L12)
- 20. Wed 10/10 Review for midterm
- 21. Thurs 10/11 Midterm exam
- 22. Mon 10/15 (L13)
- 23. Wed 10/17
- 24. Thu 10/18 (L14)
- 25. Mon 10/22 (L15)
- 26. Wed 10/24
- 27. Thu 10/25 (L16)
- 28. Mon 10/29
- 29. Wed 10/31
- 30. Thurs 11/1 (L17)
- 30.1 Possible spring courses
- 30.2 Lighting in OpenGL

- 31. Mon 11/5 (L18)
- 32. Thurs 11/8 (L19)
- 33. Mon 11/12 (L20)
- 34. Thurs 11/15 (L21)
- 35. Mon 11/19 (L22)
- 36. Thurs 11/22
- 37. Mon 11/26 (L23)
- 38. Thurs 11/29 (L24)
- 39. Mon 12/3
- 39.1 Thrun video
- 39.2 Term Project Grading

- 40. Wed 12/5 Student term project presentations
- 41. Thurs 12/6 Student term project presentations
- 42. Mon-Thurs 12/10-13 TA office hours
- 43. Tues 12/11 Review
- 44. Thu 12/13 6:30-9:30 pm
- 45. Course grade

**Week 1**

## 1. Mon 8/27 (L1)

- Discuss syllabus
- Intro to OpenGL.
- Show a simple OpenGL program, box.cpp, from the code zipfile on the publisher site.
- Reading assignment: Guha, chapter 1.
- Programs I modified: box2.cpp, box3.cpp

## 2. Wed 8/29

- Lab to start using OpenGL.

## 3. Thu 8/30 (L2)

- Correction: TA Shan Zhong's email is zhongs2ATrpiDOTedu. Sorry.
- TA office hours. Come near the start of the time. If no one comes, they
will leave. Later in the semester, when demand is greater, we may expand
these. The TAs will be in the
*ECSE Flip Flop Lounge*, JEC6037, x5397. If these times are not convenient, please write them to schedule a private meeting at a convenient time.- Tuesday 6pm-7pm, Xiaoyang Wang
- Friday 4pm-5pm, Shan Zhong

- Hike: Dean Trinkle and I are considering a student-prof hike on Monument Mt in Mass. on Sunday Oct 21. Details later. http://www.thetrustees.org/assets/documents/places-to-visit/trailmaps/Monument-Mountain-Trail-Map.pdf
- Show
- John Cleese PC ad The broader moral of this story is that computer graphics is not theoretical math, but depends on HW. As HW gets faster, CG gets better.
- History of Computer Animation - P1. Note that this is one person's view; there were many other contributors.

- Programs:
- Play with box.c

- Program I modified: square2.cpp
- Lecture notes: 0830.pdf

**Week 2**

## 4. Linear algebra tutorial

- For students confused by the linear algebra questions on homework 1, the following may help:
- Also see wikipedia.
- Some older graphics texts have appendices summarizing the relevant linear algebra.
- The scalar (dot) product is needed to do things like this:
- compute how a ball bounces off a wall in pong
- compute lighting effects (how light reflects from a surface)

- The cross product's applications are mostly in engineering, e.g., to compute torque and angular momentum. It also computes the area of a parallelogram.
- The triple product (A.BxC) computes the volume of a parallelepiped.

## 5. Thu 9/6 (L3)

- Note on Engineering Grounded In Reality and famous graphics alumni.
- Executive summary of Portability And Standards.
- GLUT - The OpenGL Utility Toolkit interfaces between OpenGL and your windowing system. It adds things, such as menus, mouse and keyboard interface, that were considered too platform-dependent and too far outside OpenGL's core mission to include in OpenGL. GLUT is platform independent, but quite basic. There are several alternatives, some of which are platform dependent but more powerful. You can't always have everything at once. However GLUT is the safe solution.
- I've assembled some important OpenGL points here" OpenGL Design tradeoffs and notes
- Homework 2 is out; due in one week.
- New programs from Guha:
**circle.cpp**(page 46) shows lineloop and approximating a curve with a polyline.**circularannuluses.cpp**(p 48) 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.**helix.cpp**(p 51): perspective and ortho projections**hemisphere.cpp**(p 59) shows- rotation and translation
- perspective projection

**squareannulus*.cpp**(p 68) show more efficient ways to plot lots of vertices.

- Watch part 2 of the history of graphics.
- Graphics display hardware, based on Guha page 15.
The progress of Computer Graphics is largely the
progress of hardware. We'll see more of this later.
However, here's an intro.
- What physical principles are each type of HW based on?
- CRT: certain rare earth materials emit photons when hit by electrons. Explaining this is what got Einstein his Nobel (not relativity).
- LCD: electric field causes big asymmetric molecules to untwist so that they no longer rotate polarized light passing through them.

- What engineering challenges required solving?
- Shadow-mask CRT: electron beams travel varying distances at different angles, but don't hit the wrong phosphor even as the system gets hotter. The precision is 0.1%.
- Hi-performance graphics requires hi bandwidth memory.
- Virtual reality headsets require knowing where your head is and its angle (harder).

- What tech advances enabled the solutions?
- Raster graphics requires cheap memory.
- LCD panels require large arrays of transistors.

- What physical principles are each type of HW based on?
- Lecture notes: 0906.pdf

**Week 3**

## 6. Lecture and lab swaps

Because I'll be away next week at the Autocarto and GIScience conferences including the International Workshop on Modern Accelerator Technologies for GIScience in Columbus, as a speaker and program committee member:

- Wed Sep 12 and Sep 28 will be regular lectures, in Walker 6113.
- Mon Sep 17 and Thu Sep 20 will be labs, for you to ask the TAs for help. There will be no scheduled activities.

## 7. Mon 9/10 (L4)

- Programs that I modify in class are frequently stored here: modified-guha/
- New programs from Guha:
**squareannulus*.cpp**(p 68) show more efficient ways to plot lots of vertices.

- Lecture notes: 0910.pdf

## 8. Wed 9/12 (L5)

*This is a regular lecture.*

*Note:* Given that 'Prediction is very difficult, especially about the
future.' - Niels Bohr, lists of topics to be covered in future lectures are
tentative. After each class, I will update this wiki to reflect what
actually happened.

- Rehash squareannulus*.cpp in more detail.
- SIGGRAPH 2012 Technical Papers Video Preview
- Go through the homework questions.
- More OpenGL programs
- squareAnnulusAndTriangle, p 69: interspersed vertex and color data
- helixList.cpp:
- display list
- push and pop transformation

- multipleLists.cpp: multiple display lists
- cube.cpp -a new program to draw a cube with glDrawElements, modified from squareAnnulusAndTriangle.

- Most Realistic Computer Graphics - NVIDIA human head demo
- Lecture notes: 0912.pdf

## 9. Thu 9/13 (L6)

- SIGGRAPH 2011 Technical Papers Video Preview
- Programs
- fonts.cpp, p 72: bitmapped and stroke fonts
- mouse.cpp: mouse button callback
- mouseMotion.cpp: mouse motion callback
- moveSphere.cpp, p 76: non ASCII key callback
- menus.cpp - p 77
- nopush.cpp - a new program to test what happens if you pop from the matrix stack w/o pushing. The program produces no output.
- extrapush.cpp - a new program to test the effect of more pushes than pops. The stack did not overflow, for the number of extra pushes that I tried.
- cube2.cpp - a new program to draw a cube (with glDrawElements) into a display list in the setup routine. Thus, the cube is drawn only once. The drawScene routine just calls that display list. For large scenes this should be much more efficient.

- Lecture notes: 0913.pdf
- Homework 3 is out; due in one week.

**Week 4**

## 10. Mon 9/17

An open lab, to ask for help.

## 11. Wed 9/19

An open lab, to ask for help.

## 12. Thu 9/20

- An open lab, to ask for help.
- Homework 4 online, due Sept 27.

**Week 5**

## 13. Mon 9/24 (L7)

- Videos
- Programs
- Review menus and cube2.
- lineStipple.cpp - p 77 - Set a line stipple.
- canvas.cpp - p 78 - Primitive drawing program.
- glutObjects.cpp - p 80
- 9 builtin glut polyhedra
- rendered both shaded and as wire frames,
- rotated by user input
- initial look at lighting in OpenGL; we'll see this a lot more.
- enabling lighting,
- enabling specific lights,
- material properties,
- diffuse, ambient and specular lights.

- clippingPlanes.cpp - p 82
- add more clip planes to the 6 original ones (the sides of the view volunme)
- enable and disable clipping planes.
- enabling specific clipping plane,
- clipping plane equation.

- viewports.cpp - p 86
- change the viewport to a different part of the window, and draw more stuff.

- windows.cpp - p 87
- multiple top level windows, each with its own callbacks.

- Soon 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.

## 14. Wed 9/26

Open lab.

## 15. Thu 9/27 (L8)

- Videos
- Start Chapter 4, transformations.
- Dreamworks coming Dec 5. More later.
- I talked a little about
*broader impact*, i.e., why should the taxpayer fund this stuff? My example was research into simulating flames. When you are job hunting, you should ask yourself what benefit your potential employer would get from hiring you. When I write a proposal to a federal agency to get money, I mention how it would benefit from funding me. - Lecture notes: 0927.pdf

**Week 6**

## 16. Mon 10/1 (L9)

- Videos
- Transformation review
- Each type of common transformation (translate, rotate, scale, project) is a matrix.
- If applying several transformations, it is faster to first multiply the matrices, then just multiply all the points by that one matrix.
- Most OpenGl transformation routines modify one of two current transformation matrices: the modelview or the projection.
- 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).
- 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.
- The last transformation catenated onto the current matrix is the first transformation applied to the object.
- OpenGL combines the two matrices, so the modelview matrix is applied first to the object.

- Rotations:
My note on 3D rotation
- 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.
- deriving the vector formula for a rotation given the axis and angle
- computing the matrix from a rotation axis and angle
- testing whether a matrix is a rotation
- if it is, then finding the axis and angle

- Lecture notes: 1001.pdf

## 17. Wed 10/3 (L10) Regular lecture

- Videos
- Programs
- rotatingHelix{1,2,3}.cpp

- Lecture notes: 1003.pdf

## 18. Thu 10/4 (L11)

- Videos
- Programs
- speedtest1.cpp, speedtest2.cpp, speedtest3.cpp Programs I wrote to test speed of using display list, gldrawelements, and explitic
*for*loop. - composeTransformations.cpp
- box.cpp with blocks 10 and 13 inserted (separately, not both at once)
- ballAndTorus.cpp, p 120
- ballAndTorusWithFriction.cpp, p 124
- clown head, p 125
- flowerintPoint.cpp, p 129

- speedtest1.cpp, speedtest2.cpp, speedtest3.cpp Programs I wrote to test speed of using display list, gldrawelements, and explitic
- Lecture notes: 1004.pdf

**Week 7**

## 19. Tues 10/9 (L12)

- Video: SIGGRAPH 2012 : Emerging Technologies
- Euler and angles and Gimbal lock
- http://www.youtube.com/watch?v=rrUCBOlJdt4&feature=related Gimble Lock - Explained. One problem with Euler angles is that multiple sets of Euler angles can degenerate to the same orientation. Conversely, making a small rotation from certain sets of Euler angles can require a jump in those angles. This is not just a math phenomenon; real gyroscopes experience it.
- http://en.wikipedia.org/wiki/Gimbal_lock
- What is Gimbal Lock and why does it occur? - an animator's view.

- Programs
- boxWithLookAt transformation, p 133 - shows gluLookAt
- spaceTravel1.cpp, p 153 - changes camera viewpoint as spacecraft moves
- animateMan1.cpp etc, p 157 - interactively construct, then replay, an animation sequence with actor's joints' positions changing.
- ballAndTorusShadowed.cpp, p 161 - simulate a shadow
- selection.cpp, p 163

- Picking The user selects an object on the display with the mouse. How can we tell which object was selected? This is a little tricky. E.g., The selected object may be one instance of a display list that was drawn several times, called from another display list that itself was drawn several times. We want to know, sort of, the whole call stack.
- Reading: Guha p 161-169.
- The various methods are messy; only method that you need to know is setting the object id into the color buffer.
- Lecture notes: 1009.pdf

## 20. Wed 10/10 Review for midterm

- I'll be here to answer questions and review old exams.
- Lecture notes: 1010.pdf

## 21. Thurs 10/11 Midterm exam

- Open book, open notes
- Questions based on the programs and material covered in class, up through lecture 11.
- Midterm)F2012, Solution.

**Week 8**

## 22. Mon 10/15 (L13)

- Quaternions. This is an alternative method to
rotate in 3D. Its advantages are:
- It starts from the intuitive axis-angle API.
- 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.)
- When combining multiple rotations, the axis and angle of the combo is easy to find.
- 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.)
- Note on 3D Interpolation.
- Guha p 253-268.

- Lecture notes: 1015.pdf

## 23. Wed 10/17

Lab to get back your graded midterms, and to query the TAs about any grading issues. Do it now; don't wait.

## 24. Thu 10/18 (L14)

Announcements:

- Project proposal not due until Mon, to give you time to ask questions in class today.
- Homework 6 online, due next Thurs.
- All grades should be on RPILMS, including an estimated grade for the 1st half of the course, computed at 1/2 for the homeworks (all weighted equally) and 1/2 for the midterm exam. Comment: the class is doing excellent!
- Jeff Trinkle and I are planning a faculty-student hike on Monument Mt near Great Barrington for this Sunday. It's relatively easy. Contact him, copy to me, if you're interested.

New material:

- View normalization or projection normalization
- We want to view the object with our desired perspective projection.
- 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).
- However, the default parallel projection of this normalized object gives exactly the same result as our desired perspective projection of the original object.
- Therefore, we can always clip against a 2x2x2 cube, and project thus: (x,y,z)->(x,y,0) etc.
- Guha p 643-655.

- Homogeneous coordinates This is today's big idea HomogeneousCoords
- Lecture notes: 1018.pdf

**Week 9**

## 25. Mon 10/22 (L15)

- Homogeneous coordinates, ctd.
- Parallel lines intersect at an infinite point
- There is a line through any two distinct points
- Projection matrices in more details,

- Lighting

This is the next topic. To prepare, read Guha, Section VI, Chapter 11, 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:

- Tetrachromacy Some women have 2 slightly different types of green cones in their retina. They see 4 primary colors.
- Metamers Different colors (either emitted or reflected) with quite different spectral distributions can appear perceptually identical. With reflected surfaces, this depends on what light is illuminating them. Two surfaces might appear identical under noon sunlight but quite different under incandescent lighting.
- CIE chromaticity diagram This maps spectral colors into a human perceptual coordinate system. Use it to determine what one color a mixture of colors will appear to be.
- Next topic: chapter 10
- Lecture notes: 1022.pdf

## 26. Wed 10/24

Lab to talk to the TAs.

## 27. Thu 10/25 (L16)

- Project proposal submission
- Please submit all proposals via RPILMS even if you emailed me.
- If you have a team, could one person submit the proposal and the others submit just a statement of the team leader.

- View normalization or projection normalization
- We want to view the object with our desired perspective projection.
- To do this, we can transform the object into another object that looks like an amusement park fun house (all the angles and lengths are distorted).
- However, the default parallel projection of this normalized object gives exactly the same result as our desired perspective projection of the original object.
- Therefore, we can always clip against a 2x2x2 cube, and project thus: (x,y,z)->(x,y,0) etc.

- OpenGL modelview vs projection matrices.
- 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).
- 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.

- My note on NTSC And Other TV Formats.
- Debugging OpenGL: The OpenGL FAQ and Troubleshooting Guide is old but can be useful.
- Computer graphics in the real world (enrichment only)
- Forma Urbis Romae - reconstruction of a street map of 211AD Rome from 1186 pieces like this one:

- Another OpenGL tutorial The Practical Physicist's OpenGL tutorial Edward S. Boyden
- Steve Baker's notes on some graphics topics:
- Phong lighting model: The total light at a pixel is the sum of
- Incoming ambient light times ambient reflectivity of the material at the pixel,
- Incoming diffuse light times diffuse reflectivity times a factor for the light source being low on the horizon,
- 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,
- Light emitted by the material.

- That is not intended to be completely physical, but to give the programmer lots of parameters to tweak.
- OpenGL has several possible levels of shading. Pick one of the following choices. Going down the list makes the shading better but costlier.
- Shade the whole polygon to be the color that you specified for one of the vertices.
- Bilinearly shade the polygon, triangle by triangle, from the colors you specified for its vertices.
- 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. - 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.

- Computing surface normals. See page 442ff.
- 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.
- If it's a parametric surface, partial derivatives are tangent vectors.
- A
*mesh*is a common way to approximate a complicated surface. - For a mesh of flat (planar) pieces (facets):
- Find the normal to each facet.
- Average the normals of the facets around each vertex to get a normal vector at each vertex.
- Apply Phong (or Gouraud) shading from those vertex normals.

- Homework 7 out, due next Thurs.
- Lecture notes: 1025.pdf

**Week 10**

## 28. Mon 10/29

No class; RPI closed

## 29. Wed 10/31

lab to ask questions of the TAs

## 30. Thurs 11/1 (L17)

### 30.1 Possible spring courses

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

- CSCI-4530/6530 ADVANCED COMPUTER GRAPHICS, T F 2:00 3:50PM Cutler
- ARTS-4020-01 ADV DIGITAL 3D PROJECTS TF 12-1:50 Lawson

### 30.2 Lighting in OpenGL

- http://www.glprogramming.com/red/chapter05.html is a good description.
- Also Guha, ...
- Programs:
- sphereInBox1.cpp
- sphereInBox1a.cpp, sphereInBox1b.cpp show that the light position uses the current ModelView matrix.
- lightAndMaterial1.cpp
- interactively change material properties
- new: attenuating distant light

- lightAndMaterial2.cpp
- interactively change light properties
- moving light

- spotlight.cpp
- new: spotlights, colormaterial mode

- litTriangle.cpp - 2 sided lighting
- checkeredFloor.cpp - flat shading to draw checkered floor.

- Lecture notes: 1101.pdf

**Week 11**

## 31. Mon 11/5 (L18)

- Xiaoyang Wang talked about Chapter 12, textures.
- Motivation of using textures: Adding per-pixel surface details without raising the geometric complexity of a scene.
- Textural mapping: The mapping of any image into multidimensional space.
- Often used mapping shapes: planar mapping, cylindrical mapping, spherical mapping
- About map entity: material, bump mapping, light mapping
- Functions in OpenGL: glTexImage2D, glTexCoord2f, glTexParameteri

- Lecture notes: 1105.pptx

## 32. Thurs 11/8 (L19)

- Shan Zhong talked about Chapter 13 and the start of 14.
- Lecture notes: 1108.pptx

**Week 12**

## 33. Mon 11/12 (L20)

News from outside world: ivan-sutherland-wins-kyoto-prize. Sjetchpad demo.

Chapter 10. Big idea: curves. Big questions:

- What math to use?
- How should the designer design a curve?
- OpenGL implementation.
- Reading: bezier.pdf
Coming up: student presentations are Dec 3, 5 and 6.
~~I was going also to use Dec 3, but Dreamworks is coming then.~~Unfortunately, Dreamworks canceled. We'll have~~1/2~~1/3 the presentations on each day, running for 2 hours. Each team will get the same time, regardless of team size. I'll bring a signup sheet to classes for those who prefer one of those days, up to the capacity of each day. First come, first served. - Partial summary:
- To represent curves, use parametric (not explicit or implicit) equations.
- Use connected strings or segments of low-degree curves, not one hi-degree curve.
- If the adjacent segments match tangents and curvatures at their common joint, then the joint is invisible.
- That requires at least cubic equations.
- Higher degree equations are rarely used because they have bad properties such as:
- less local control,
- numerical instability (small changes in coefficients cause large changes in the curve),
- roundoff error.

- One 2D cartesian parametric cubic curve segment has 8 d.f. {$ x(t) = \sum_{i=0}^3 a_i t^i$}, {$ y(t) = \sum_{i=0}^3 b_i t^i$}, for {$0\le t\le1$}.
- Requiring the graphic designer to enter those coefficients would be unpopular, so other APIs are common.
- Most common is the
*Bezier*formulation, where the segment is specified by 4 control points, which also total 8 d.f.: P0, P1, P2, and P3. - The generated curve starts at P0, goes near P1 and P2, and ends at P3.
- The curve stays inside the control polygon, the convex hull of the control points. A flatter control polygon means a flatter curve.
- A choice not taken would be to have the generated curve also go thru P2 and P3. That's called a Catmull-Rom-Oberhauser curve. However that would force the curve to go outside the control polygon by a nonintuitive amount. That is considered undesirable.
- Instead of 4 control points, a parametric cubic curve can also be specified by a starting point and tangent, and an ending point and tangent. That also has 8 d.f. It's called a Hermite curve.
- The three methods (polynomial, Bezier, Hermite) are easily interconvertible.
- Remember that we're using connected strings or segments of cubic curves, and if the adjacent segments match tangents and curvatures at their common joint, then the joint is invisible.
- That reduces each successive segment from 8 d.f. down to 2 d.f.
- This is called a B-spline.
- From a sequence of control points we generate a B-spline curve that is piecewise cubic and goes near, but probably not thru, any control point (except perhaps the ends).
- Moving one control point moves the adjacent few spline pieces. That is called
*local control*. Designers like it. - One spline segment can be replaced by two spline segments that, together, exactly draw the same curve. However they, together, have more control points for the graphic designer to move individually. So now the designer can edit smaller pieces of the total spline.
- Extending this from 2D to 3D curves is obvious.
- Extending to homogeneous coordinates is obvious. Increasing a control
point's weight attracts the nearby part of the spline. This is called
a
*rational*spline. - Making two control points coincide means that the curvature will not be
continuous at the adjacent joint.
Making
*three*control points coincide means that the*tangent*will not be continuous at the adjacent joint. Making*four*control points coincide means that the*curve*will not be continuous at the adjacent joint. Doing this is called making the curve (actually the knot sequence)*non-uniform*. (The knots are the values of the parameter for the joints.) - Putting all this together gives a non-uniform rational B-spline, or a
*NURBS*. - A B-spline
*surface*is a grid of patches, each a bi-cubic parametric polynomial. - Each patch is controlled by a 4x4 grid of control points.
- When adjacent patches match tangents and curvatures, the joint edge is invisible.
- The surface math is an obvious extension of the curve math.
- {$ x(u,v) = \sum_{i=0}^3\sum_{j=0}^3 a_{ij} u^i v^j $}
- {$y, z$} are similar.
- One patch has 48 d.f., although most of those are used to establish continuity with adjacent patches.

- Lecture notes: 1112.pdf

## 34. Thurs 11/15 (L21)

- Chapters 10, 15, and 16.
- My extra enrichment info on splines: Splines.
- Guha's treatment of evaluators etc. is weak. I recommend the googling for better descriptions. This one is good: OpenGL Programming Guide - Chapter 12 Evaluators and NURBS
- Different books define B-splines slightly differently, especially with the subscripts and end conditions.
- Other topics from chapter 10:
- swept volumes
- regular polyhedron
- quadrics

- Programs covered:
- bezierCurves, p 390
- bezierCurveWithEvalMesh, p 391
- bezierCurveWithTangent, p 392
- bezierSurface, p 392
- bezierCanoe, p 394
- torpedo, p 395
- deCasteljau3, p 565
- sweepBezierSurface, p 578
- bSplines, 594

- Lecture notes: 1115.pdf

**Week 13**

## 35. Mon 11/19 (L22)

- A little more on splines:
- cubicSplineCurve2
- This shows how to do a NURBS curve in OpenGL. When you drag a control point, only the closest segments of the curve move.
- The starting and ending knots are each repeated four times. That makes the spline go through the ending control points.

- bicubicSplineSurfaceLitTextured
- This shows a NURBS surface.
- When you rotate the surface, the light (the small black square) does not rotate. Therefore the highlights change.
- Lighting, texture, and the depth test are both enabled.
- Surface normals are automatically computed from the surface, and then used by the lighting.
- The texture modulates the computed lighting.
- Both surface coordinates (vertices) and texture coordinates are NURBS.

- trimmedBicubicSplineSurface The shows trimming a NURBS surface to cut out holes. The trimming curve can also be a B-spline. It is defined in the parameter space of the surface. If the surface's control points are moved, the trimming curve moves along with the surface.

- cubicSplineCurve2
- The OpenGL SuperBible has a lot of code. Each version has two parallel directory trees - for the source and the executables. Don't move files around. You need to compile and run from the executable tree.
- The fixed graphics pipeline:
- Process vertices, e.g. to apply transformations and compute normals.
- Rasterize, i.e., interpolate data from vertices to pixels (fragments)
- Process fragments, e.g., to compute Phong shading.

- Shaders: Customize steps (a) and (c) above.;
- GPU programming - vertex and fragment shaders etc.
- Guha's description in Chapter 20 is excellent.
- GLSL/RedSquare
- GLSL/MultiColoredSquare2
- GLSL/InterpolateTextures
- GLSL/BumpMappingPerVertexLighting
- GLSL/BumpMappingPerPixelLighting

- Homework 9 out, due Thurs Nov 29.
*Thanksgiving trivia questions:*- What language did Samoset, the first Indian to greet the Pilgrims, use?
*Answer:*http://www.holidays.net/thanksgiving/pilgrims.htm - How many European countries had Squanto, the 2nd Indian to greet the Pilgrims, visited?

- What language did Samoset, the first Indian to greet the Pilgrims, use?
- Lecture notes: 1119.pdf

## 36. Thurs 11/22

No lecture. Optional reading material:

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

**Week 14**

## 37. Mon 11/26 (L23)

- getinfo.cpp shows how to retrieve OpenGL state info, such as version.
- More shader examples. These are from the 4th edition of the
OpenGL Superbible. The
local copy of the code and book is here. (The 5th
edition has some negative reviews because of how they updated their code
for the latest OpenGL version.)
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:- chapt16/vertexblend
- chapt16/vertexshaders
- chapt17/bumpmap
- chapt17/fragmentshaders
- chapt17/imageproc
- chapt17/lighting
- chapt17/proctex

- Next week is for student fast forward presentations. (This technique is popular at conferences.)
- Each team is to prepare a
**5-minute timed**MS Powerpoint presentation on your project. - I will run the presentations continuously w/o a break.
- Your five minutes will include the time it takes you to get to the front of the class.
- The whole presentation must be in one ppt or pptx file.
- You may talk while your presentation is running, or remain silent (but then it should have sound).
- You must not talk into the next person's presentation.
- Mail me (at mail @ w r f r a n k l i n . o r g) your presentation by
**9am**on the day of your presentation. If your file is over 2MB, then upload it somewhere and send a link. (Also consider using a better codec.)

- Each team is to prepare a
- Regardless of your presentation time, your project is due on Dec 6.
- Lecture notes: 1126.pdf

## 38. Thurs 11/29 (L24)

- 10 minutes for filling out survey
- Aliasing and anti-
- The underlying image intensity, as a function of x, is a signal, f(x).
- When the objects are small, say when they are far away, f(x) is changing fast.
- To display the image, the system evaluates f(x) at each pixel. That is, f(x) is sampled at x=0,1,2,3,...
- If f(x), when Fourier transformed, has frequencies higher than 1/2 (cycle per pixel), then that sampling is too coarse to capture the signal. See the Nyquist sampling theorem.
- When this hi-freq signal is sampled at too low a frequency, then the result computed for the frame buffer will have visual problems.
- It's not just that you won't see the hi frequencies. That's obvious.
- Worse, you will see fake low frequency signals that were never in the
original scene. They are called
**aliases**of the hi-freq signals. - These artifacts may jump out at you, because of the Mach band effect.
- Aliasing can even cause (in NTSC) rapid intensity changes to cause fake colors and vv.
- Aliasing can occur with time signals, like a movie of a spoked wagon wheel.
- This is like a strobe effect.
- The solution is to filter out the hi frequencies before sampling, or
sample with a convolution filter instead of sampling at a point.
That's called
**anti-aliasing**. - OpenGl solutions:
- Mipmaps.
- Compute scene on a higher-resolution frame buffer and average down.
- Consider pixels to be squares not points. Compute the fraction of each pixel covered by each object, like a line. Lines have to have finite width.

- Refs:
- http://en.wikipedia.org/wiki/Aliasing
- http://en.wikipedia.org/wiki/Clear_Type
- http://en.wikipedia.org/wiki/Wagon-wheel_effect
- http://en.wikipedia.org/wiki/Spatial_anti-aliasing (The H Freeman referenced worked at RPI for 10 years).
- http://en.wikipedia.org/wiki/Mipmap
- http://en.wikipedia.org/wiki/Jaggies

- Chapter 19: ray tracing, radiosity. Other refs:
- Visibility methods:
*Painters:*- The painter's algorithm is tricky when faces are close in Z.
- Sorting the faces is hard and maybe impossible. Then you must split some faces.
- However sometimes some objects are always in front of some other objects. Then you can render the background before the foreground.

*Z-buffer:*- Subpixel objects randomly appear and disappear (aliasing).
- Artifacts occur when objects are closer than their Z-extent across one pixel.
- This happens on the edge where two faces meet.

*BSP tree:*- In 3D, many faces must be split to build the tree.

- The scanline algorithm can feed data straight to the video D/A. That was popular decades ago before frame buffers existed. It is popular again when frame buffers are the slowest part of the pipeline.
- A real implementation, with a moving foreground and fixed background, might combine techniques.
- References: wikipedia.

- Lecture notes: 1129.pdf

**Week 15**

## 39. Mon 12/3

### 39.1 Thrun video

There are no student presentations today. (Everyone who was listed either has dropped or is teamed with some who is presenting later.)

So I will show a video of Sebastian Thrun's keynote talk at this 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).

It is also a marvelous example of a successful engineering project. Many different parts all have to work to make the total project succeed. They include laser rangefinding, image recognition, a road database accurate to the specific lane, and GPS navigation. This is also a model for government - university - industry interaction.

DARPA (The Defense Advanced Research Projects Agency) started this concept with a contest paying several $million in prizes. (DARPA started connecting computers in different cities with phone lines in 1968. This was the ARPAnet. They funded computer graphics in the 1970s and some early steps in virtual reality in the 1980s.)

In the 1st contest, the best vehicle failed after about 10 miles. Five vehicles completed the 130 mile course in the 2nd contest. The winning project leader was Sebastian Thrun, a Stanford CS prof. He quit and moved to Google, who has now been funding this for several years.

Here is the talk abstract:

- 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.

Finally, Dr Tony Tether, Director of DARPA when this happened, is an RPI BS EE grad.

### 39.2 Term Project Grading

Fast forward presentation | |
---|---|

project clearly described | 10 |

good use of video or graphics | 10 |

neat and professional | 10 |

Project itself | |

Graphics programming with good coding style | 10 |

Use of interactivity or 3D | 10 |

A nontrivial amount of it works (and that is shown) | 10 |

Unusually creative | 10 |

Writeup | |

describes key design decisions | 10 |

good examples | 10 |

neat and professional | 10 |

Total | 100 |

Notes:

- In addition to the above list, rules violations such as late submission of the powerpoint file, or a project that is seriously off-topic will have an effect.
- A 10-minute demonstration to Shan or Xiaoyang is optional. If you do, they will give me a modifier of up to 10 points either way. I.e., a good demo will help, a bad one hurt.

## 40. Wed 12/5 Student term project presentations

- Brundige & Matiz
- Chen & Felizardo & Keller
- Devik
- Hanov
- Johnsen & Kaplan
- McCormick & Whitworth
- Shippee & Towns & Zondler
- Westrich
- Williams

## 41. Thurs 12/6 Student term project presentations

- Ahier & McKenzie
- Alexander & Lsrsen
- Benedetti
- Brenner & DeBartolomeo
- Brundige & Matiz
- Chan
- de Souza
- Devik
- Di Pietro
- Eastman & Grube
- Gruar
- Knobloch
- Minto & Truhlar
- Reome & Wang & Zhu
- Stauffer

Note: Submit your term project on LMS. Thanks.

**Week 16**

## 42. Mon-Thurs 12/10-13 TA office hours

Use this time if you wish to demo your project.

- Monday: 10:00AM - 12:00 PM Shan
- Tuesday: 10:00AM - 12:00 PM Xiaoyang
- Wednesday: 10:00AM - 12:00 PM Shan
- Thursday: 10:00AM - 12:00 PM Xiaoyang

Location: JEC6037, the flipflop lounge.

## 43. Tues 12/11 Review

4-5:30 pm. Walker 6113. WRF.

- Review notes: 1211.pdf

## 44. Thu 12/13 6:30-9:30 pm

## 45. Course grade

- I uploaded things to LMS on 12/16 and will put them in SIS tomorrow.
- TOTAL is your total grade, computed as follows:
- Homeworks 25%, each scaled to 10, the lowest dropped.
- Midterm exam 25%
- Term project 25%. Of that the writeup and optional demo was 70% and presentation 30%.
- Final exam 25%.
- 1% added for catching each serious error that I made. Only a few students did this.

- LETTER: I rounded TOTAL before computing LETTER. So, an A was 94.5 and up.
- RANK: Your rank in the class from 1 to 40.

I hope that you enjoyed learning Computer Graphics. If you'd like to ask questions or talk, I'm available in the future.