Course outline

CS 248 - Introduction to Computer Graphics
Autumn Quarter, 2004
Marc Levoy
Handout #1

Table of contents:



Marc Levoy
Gates Computer Science Building, Room 366
(650) 725-4089
Office hours: Tue/Thu 11:00am - 12:15pm and by appointment

Teaching assistants

Sean Walker
Gates Computer Science Building, Room 124
(650) 725-8795
Office hours: Wed/Fri 3:00 - 5:00pm, Gates Hall 124

Michael Green
(530) 848-6882
Office hours: Mon/Tue 4:00 - 6:00pm, Sweet Hall 029

Joint email address:


Ada Glucksman
Gates Computer Science Building, Room 368
(650) 725-3724

Lectures and help sessions

There will be twenty lectures. The topics to be covered, with approximate dates, are given in the course schedule. These lectures will be given live in Gates B01, broadcast on SITN (channel E4), and encoded for Stanford Online. In addition, I will place my lecture notes online, linked off of the class schedule, as soon as possible after each lecture.

There will also be help sessions on the Wednesday of each week in which a project is assigned, i.e. on Oct. 6, Oct. 20, and Nov. 3, and for project #3 there will be a second help session on Friday, Nov. 5. There will also be review sessions on the Friday of each week before an exam, i.e. on Oct. 29 and Dec. 3. The Wednesday sessions will be 5:45pm - 6:35pm, the Oct. 29 and Nov. 5 help session will be at 3:15 - 4:05pm, and the Dec. 3 help session will be at 5:15 - 6:05. All of these sessions will be in Gates B01 and will be televised on SITN channel E2 or E5. The dates of these sessions are also summarized in the course schedule (HO #2). Other than these dates, there will be no classes or discussions meetings on Wednesdays or Fridays.

Despite all the broadcast and encoding technology, it would give me (and the TAs) great pleasure to see the alert, smiling faces of my on-campus students in the classroom. Although the course is large, you'll find the lectures to be surprisingly interactive. I teach because I enjoy these interactions. You'll also learn more if you attend class, and I'll get a better sense of how well the material is getting across. If you cannot attend a particular class, the lectures will be available online, as mentioned above. However, I appeal to you not to abuse this system. If the only time I see you in person is during grading sessions, we have both lost something precious.


Required: Foley, van Dam, Feiner, and Hughes,
Computer Graphics: Principles and Practice,
second edition in C, Addison-Wesley.
Click here for errata
Required: Shreiner, Woo, Neider, and Davis,
OpenGL Programming Guide,
fourth edition, Addison-Wesley.
Required: Möller and Haines,
Real-Time Rendering,
second edition, A K Peters, 2003.

Copies of all three texts are available in the textbook and general computer science sections of the campus bookstore. Readings from Foley, van Dam, Feiner, and Hughes will be assigned throughout the course. The OpenGL book will be used only in the last half of the course. We first want you to learn how OpenGL's graphics primitives work. Afterwards, you can start using it as a power tool. The Real-Time Rendering book covers programming techniques you'll find useful when writing your video game, so it too will be used mainly toward the end of the course.

Additional readings

We will also read a number of papers from current journals and conference proceedings. I will hand out copies of these papers in class as they become relevant. All required reading (including from the textbooks) will be assigned verbally in class as well as being listed in the course schedule.

Reserve readings

I am placing the following materials on 2-hour reserve at the Stanford Math/Computer Science Library.

  1. Foley, van Dam, Feiner, and Hughes, Computer Graphics: Principles and Practice, second edition in C, Addison-Wesley.
  2. Shreiner, Woo, Neider, and Davis, OpenGL Programming Guide, fourth edition, Addison-Wesley.
  3. Moeller (Moller) and Haines, Real-Time Rendering, second edition, A K Peters, 2003.
  4. Watt, 3D Computer Graphics, third edition, Addison-Wesley, 2000.
  5. Watt and Policarpo, 3D Games, Volume 1: Real-time Rendering and Software Technology, Addison-Wesley, 2000.
  6. Andrew Glassner, Graphics Gems,Academic Press.
  7. James Arvo, Graphics Gems II, Academic Press.
  8. David Kirk, Graphics Gems III, Academic Press.
  9. Paul Heckbert, Graphics Gems IV, Academic Press.
  10. Alan Paeth, Graphics Gems V, Academic Press.

Numbers 6 through 10 are compendiums of graphics tricks, hacks, and useful algorithms. These five books are so popular that if I don't place them on reserve, you'll have to buy them to read them - not a bad idea in any case.

Also on reserve (permanently) are the proceedings of ACM Siggraph, the premiere forum for publication of research results in the field of computer graphics. I will frequently reference Siggraph papers during my lectures. I encourage you to browse these books; you will find them inspirational in times of suffering and a wellspring of good ideas for your projects.

Course prerequisites

CS 248 assumes no prior knowledge of computer graphics. However, most students taking 248 have had some exposure to graphical user interfaces and interaction techniques, usually through CS 107 or 108. Formally, we require CS 107 and Math 103. However, we do not enforce these prerequisites. More specifically, we assume some programming experience in C (or C++) on a UNIX workstation, and we assume a basic knowledge of calculus and linear algebra. An exposure to digital signal processing or Fourier analysis is useful, but it is not required.

Course requirements

In addition to regularly scheduled readings, the workload for this course consists of three programming projects, an evening midterm examination, and a final examination. The midterm will be on Monday, Nov. 1, at 7:00 - 9:00pm. The final will be on Monday, Dec. 6, at 3:30pm. SITN students must come to campus for both exams. Makeup exams will be offered only in extreme circumstances, and must be approved in advance. A makeup final exam will not be offered to students because they are taking conflicting classes, since doing so is prohibited by the registrar.

The first two projects teach you how to write low-level imaging and graphics primitives, while being fun at the same time. The last project asks you to implement a 3D video game of your own design, in OpenGL. It will be impossible not to have fun on this project.

  1. Paint program - 24-bit painting program that includes a weighted mask-driven tinting brush.
  2. Rasterizer - Polygon scan converter with antialiasing and an interactive interface.
  3. Video game - an interactive 3D video game of your own design. You will use OpenGL for this project.

For all projects, you will demo your program to myself or a teaching assistant. Demos will be held in the Sweet Hall basement graphics lab during university business hours. For project #3, you are permitted to work in teams. If you do, then all team members must be present at the demo. To keep the project #1 and #2 demos fair, you will also be required to freeze your executable before 7:30am on demo day and to give your demo from that executable. A commented copy of your source code and a brief (1-2 pages) description of the functionality implemented are due online by 2:00pm the following day for projects #1 and #2, and two days later for project #3. These delays gives you a chance to sleep before writing up your project. ;-) We will describe in a later handout how code freezings and on-line submissions will be handled.

Grading policies

Evaluation criteria: Projects #1 and #2 will each count as 15% of your grade, project #3's first critique as 10%, and project #3's final demo and writeup as 20%. The project #3 proposal will not be graded; its purpose is for you to get feedback from us about your game idea. The midterm and final exams will each cover half of the material in the course, and will each count as 20%. Grading criteria on the projects will vary; typical criteria are correctness (40%), efficiency (20%), elegance (of your UI and your code) (20%), and originality (20%). Your workload and grade in the course will not depend on whether you are taking it for 3, 4, or 5 credits. Students taking the course P/NC must complete all assignments to receive a passing grade.

Collaboration: You may discuss the first two projects with friends, but you are expected to implement your own solutions. Sharing or looking at other students' code is not permitted. On the third project (the video game), you are permitted (and encouraged) to form teams of two or three people and to partition the work among the team members. The work expected from each team will be proportional to the size of the team. Teams may discuss their project with other teams, but each team is expected to implement the project independently. Sharing code or libraries between teams is not permitted. The exams must be individual efforts, as usual.

Borrowing code and data: As more programming resources become available online, we have found it necessary to tighten up the borrowing policies in this course, to insure a level playing field for all students. In particular, using source code, libraries, executables, or data you find on the Internet (or elsewhere) is permitted only on the third project, and is limited to geometric models of characters or props (not environments), textures, sounds, and low-level programming tools (like matrix packages). In particular, borrowing code that implements required (or extra credit) game features is not allowed. We'll elaborate more on these restrictions in the handout for the third project. This said, looking on the Internet for ideas, even looking at sample code you find there, is permitted and encouraged on all projects. However, when you do this, we expect you to cite your sources in your writeup. We also expect that your video game was developed only for this course, and that it was begun no earlier than the start of this academic quarter. We want everyone to have a fair shot at the competition; if you have already been working on a game in your spare time, it would be unfair to the rest of the class.

The honor code: Every year, a few students in this class are caught sharing code or using code downloaded from the Internet. Aside from being unfair to your fellow students, these are violations of Stanford's Honor Code. In keeping with the Honor Code, we don't go looking for these violations, but they are relatively easy to detect, and when we find one, we prosecute it, and the penalties are real and severe. If you have any doubt about whether a form of collaboration or code borrowing is permitted, just ask us; we would be happy to ease your mind. Let's spend our time learning graphics, not policing each other.

Late projects: It is important that projects be completed on time. To allow for unforeseeable circumstances, you will be allowed one weekday of grace during the quarter for either a late demo or a late writeup. Beyond this, late demos or writeups will cause you to be penalized by 10% of your grade for that assignment per weekday that either is late. If both are late, you will only be penalized once, according to the maximum lateness among them. Late demos will be accommodated subject to the availability of the TAs. If the late demo slots for a particular day are full, you may be delayed another day, possibly incurring a penalty. On project #3, neither the demo nor the writeup may be late. Exceptions to these late policies will be made only in the case of a necessary (non-pleasure) trip approved in advance, or severe illness. If you do not submit one of the assignments at all, you will probably fail the course, even if you are taking it pass/fail. In this case, or if you believe you are in danger of failing, it is your responsibility to come talk to us before the end of the course. Incompletes are given only in exceptional circumstances.

Hardware and software

Hardware: To do the projects you will have access to the Stanford Graphics Teaching Laboratory, located in a room in the basement of Sweet Hall (room 029). In fact, students in CS 248 have priority access to the machines in that room. The official web site about this room is It contains 15 Dell Optiplex GX150's (1.0 GHz Pentium 3, 512 MB RAM, NVIDIA GeForce3 graphics cards). Their names are raptor1 - raptor15. There are also 15 Dell Precision 420's (730 Mhz Pentium 3, 256 MB RAM, mixture of NVIDIA Quadro and GeForce3 graphics cards) located on the second floor of Sweet Hall. These machines are named firebird1-firebird15. Both the raptors and firebirds run Linux 2.4.20 (SULinux/Redhat 9.0). Use ssh rather than rlogin or telnet for remote access to these machines, but be aware that raptor15 prohibits remote login. Students in CS 248 will be allocated an additional 500 MB of disk space for use during the course. In the near future we'll be getting 15 Dell Precision 470n's (Dual 3.2 ghz Xeon processor, 1 GB RAM, NVIDIA Quadro FX 1300 video card). These machines will be running Debian. We will notify you when they are available.

Software: For the first project, we provide a support package based on X and Motif. To use the package, you must program in C or C++. The package provides sliders, buttons, a drawing canvas, some help with mouse and cursor interaction, and a few utilities for loading and storing images. For the second project, we provide a slightly different support package based on the GLUI toolkit, which is in turn built on OpenGL. For the third project, you will program in OpenGL.

Using other platforms: Grading of projects consists of face-to-face demos, which must be given in the basement of Sweet Hall. If you prefer working in another location, you may copy our support packages (for the first two projects) and use them locally. All you need is X, Motif, OpenGL, and the GLUI toolkit. For project #1 and #2, you must make certain that your program runs on the Sweet Hall room 029 PCs prior to demo day. Moreover, to help us judge the performance of your program, your program must be displaying on the same machine it is executing during your demo. For project #3, you must either make certain that your video game runs on the Sweet Hall room 029 PCs on demo day, or you must bring your own demo machine to Sweet Hall. Note that Sweet Hall will not permit you to plug your own computer into their network ports. Thus, if you plan to implement a networked game for project #3, and you plan to use your own computers, then you should bring your own Ethernet hub to Sweet Hall on demo day.

Online services

Student accounts: The Sweet Hall basement PCs share accounts and file servers with the Sweet Hall machine cluster. All students with leland accounts automatically have accounts on these machines. Home directories on these machines are shared with other Stanford Computing Clusters using AFS. If you do not have a leland account, surf to

Course directory: Once your account is active, log in to one of these workstations and browse through the directory /usr/class/cs248. This will be your course directory. All software and data relevant to the course will be placed here. In particular, this is where you will find the support packages for the first two projects. See the README file for more information.

World Wide Web: All class handouts, project assignments, software support packages, reading lists, and lecture notes will be available via the Web at URL Hardcopy of selected materials (but not lecture notes) will be made available in class. SITN no longer offers courier service for materials that are also online, but you can print them out from the Web. A few copies of materials made available in class will also be placed in the handout cabinet in Gates Hall, wing 3B, copy room, (room 377).

Newsgroup and TA emailing list: A newsgroup has been set up for this course. It is called su.class.cs248. It is intended for posting questions to your fellow students, looking for project partners, etc. To reduce the volume of email traffic to the TAs, we also ask you to post technical questions about programming assignments to this newsgroup. The TAs will watch the group and post their answers there. This allows everybody to benefit from the answers given to any one student. For questions about grading, or questions that would require posting snippets of code, you should instead send email to the TAs jointly at To send email to the instructor or a particular TA, use the individual email addresses listed earlier in this handout. Do not send email to multiple primary recipients, except via cs248-aut0405-tas; choose one recipient as your "To:" and make the others "CC:". Otherwise, you might get no response, or you might get multiple responses, and we'll get annoyed.

Class emailing list: For items of urgent and universal importance such as clarifications in the project assignments or bugfixes related to the support package, your instructors will use an emailing list generated automatically from the Axess class enrollment list to contact you, so please make sure you register for the course via Axess.

Video game competition

In case the delight of learning does not sufficiently motivate you to exert yourselves heroically on the projects, there will also be a video game competition. At 4:00pm on Wednesday, December 1, a judging will be held to select the best game made for project #3. While grades for the project are based mainly on technical merit, the competition will be judged on technical merit, compelling game play, and originality. The jury, to be named later, will consist of computer graphics experts from both industry and academia. There will be several awards and one grand prize of considerable value.
Copyright © 2004 Marc Levoy
Last update: October 25, 2004 08:15:55 PM