Computer Graphics MN1, 5p, Autumn 1996
This page will evolve as the course proceeds. Everything that I have
not (yet) dealt with at a lecture is subject to change.
This is particularly true of the postscript documents linked to some of the lectures;
these documents are my personal lecture notes, the manuscripts I use at the lectures.
They are not a complete description of the material covered
in the course, but they may give you an idea about what was brought
up during a particular lecture. Hint: as you probably understand, lecture documents
dated 96xxxx are more up-to-date than those dated 95xxxx.
Schedule (changes)
Introduction, Hardware:
961029 13-15 2146 F01: Introduction, overview, history, levels, exercise 1 (F1, F10.1-10.6, E1)
961030 15-17 2347 F02: Hardware, Input and output devices (F4, F8.1)
961101 10-12 1311 F03: Input and output primitives (F2, SRG)
Basic Implementation Techniques:
961104 08-10 2315 F04: 2D systems, 2D transformations, clipping (F5.2-5.6, F3.9, F3.11)
961106 13-15 2347 F05: 3D transformations, 3D viewing, clipping, projections (F5.7-5.9, F6)
Graphics Standards:
961111 10-12 2345 F06: Standards: GKS, PHIGS, X, OpenGL (F7, GL, GKS)
961113 08-10 2314 F07: PHIGS and SPHIGS, exercise 2 (F7, PH, SPH, E2)
961114 13-15 2114 F08: X / Motif, User interfaces, exercises 3 & 4 (X, F8.2-8.4, F11.4, E3, E4)
Raster Graphics:
961118 13-15 2214 F09: Raster vs. vector, Lines, Polygons, Filling (F3.2, F3.4-3.5)
961119 15-17 2344 F10: Circles, Ellipses (F3.3, F3.6-3.7, ELL)
961121 15-17 2315 F11: Text, Antialiasing (F3.12, F3.14, AA)
961125 15-17 2344 F12: Colour, Half-toning, Colour mapping (F11)
Curves and Surfaces:
961128 08-10 2344 F13: Curves, Bezier, B-splines (F9.1-9.2, F9.4, E3)
961128 13-17 2516 Lab: Exercises/assignments - practical help and advice.
961129 13-15 2344 F14: Surfaces, fractals (F9.3, F9.5, FR)
Realism:
961202 13-15 2214 F15: Hidden surfaces, Illumination (F12.1-12.5, F13)
961204 08-10 2315 F16: Illumination, Shading, Ray tracing (F14)
961205 10-12 2344 F17: CG workstations, Rendering pipeline, Image formats (S, F13.9, IF)
Visualization and Animation:
961206 08-10 2315 F18: Voxel visualization (VIS)
921209 10-12 CBA F19: Animation, MPEG (F12.6)
Conclusion:
961211 08-10 2344 F20: Repetition
961211 10-12 2516 Lab: Exercises/assignments - practical help and advice.
Exam:
961217 09-14 Polacksbacken
970113 09-14 Polacksbacken
Mandatory assignments
There are four mandatory assignments that are part of the examination of this course. You do
these either individually or in groups of two or three students. The first exercise consists
of using a visualization program (AVS) and answering a few questions about it, while the other
three are programming tasks. You are requested to hand in written reports for each exercise. In addition,
you must demonstrate your programs "live" - and be prepared to let others (in particular the teacher)
test it. Do not write very long reports: one or two pages should suffice. And do not include source code.
Teacher
Bo Nordin (bosse@cb.uu.se, 018-183470) Uppsala Universitet, TDB
(during working hours, usually found at CBA, Lägerhyddvägen 17, room 111).
The Department of Scientific Computing (TDB)
Office (room 2404), open hours: 10.30-12 (182969)
On-line information and mail
This document is also available on-line: http://www.cb.uu.se/~bosse/graphics.html. It will
be updated (hints about the exercises, schedule changes, etc.) as the course proceeds.
Mails about schedule changes and other important information will be sent to all registered students
provided they have an e-mail address they have made known to the teacher.
Literature
Exercises - the mandatory assignments
On-line hand-outs
Listed here are all hand-outs that exist in postscript versions.
A file (a folder to hold papers, not a computer file - in
Swedish pärm) that contains all hand-outs (including some
that are not available here) is placed on the shelf outside
TDB's office (or to be more precise, to the left of room 2403).
All documents that I have
not dealt with at the lectures are still subject to change
(the approximate date follows the document descriptions).
Chapter two of the textbook is the "official" SRGP manual
and chapter seven is the "official" SPHIGS manual. The postscript
documents are "extremely terse" descriptions of the packages.
Reference literature
- Hopgood, Duce, Gallop & Sutcliffe: Introduction to the Graphics Kernel System, Academic Press, 1986
- Hopgood & Duce: A Primer for PHIGS, Wiley, 1991.
- Tom Gaskin: PHIGS Programming Manual, O'Reilly & Associates, 1992.
- PostScript Language Reference Manual, Addison-Wesley, 1986.
- The Definitive Guides to the X Window System, volumes 0-5,7. O'Reilly & Associates, 1990.
- Kay & Levine: Graphics File Formats, 2nd Edition, Windcrest /McGraw-Hill 1995.
Other text-books
- Harrington: Computer Graphics. A programming approach, McGraw-Hill 1987.
- Hearn & Baker: Computer Graphics, 2nd edition, Prentice-Hall 1994.
- Burger & Gillies: Interactive Computer Graphics, Addison-Wesley, 1989.
- Foley, van Dam, Feiner &Hughes: Computer Graphics. Principles and Practice, 2nd Edition in C, Addison-Wesley, 1995.
- Angel: Interactive Computer Graphics. A Top-Down Approach with Open GLTM, Addison-Wesley, 1995.
- Watt: 3D Computer Graphics, 2d Edition, Addison-Wesley, 1993.
- Glassner (ed.): An Introduction to Ray Tracing, Academic Press, 1989.
- Cohen & Wallace: Radiosity and Realistic Image Synthesis, Academic Press, 1993.
- Preece et al: Human-Computer Interaction, Addison-Wesley, 1994.
Literature of interest(??)
- Barnsley et al: The Science of Fractal Images, Springer, 1988.
- Kaufman: Volume Visualization, IEEE Computer Society Press, 1990.
- Lancaster & Salkauskas: Curve and Surface Fitting, an Introduction, Academic Press, 1986
- Rogers: Procedural Elements for Computer Graphics, McGraw-Hill 1985.
Scientific Journals
Mandatory assignments
The course Computer Graphics has a reputation, well-earned or not, of involving a lot of
programming work. While this may be true, I don't think that the overall work load is more
than the five weeks the credit points correspond to. The assignments are designed to constitute about 50 %
of the examination, probably a great deal more if the effect that working with them has on
your general knowledge of computer graphics is taken into consideration.
The deadlines below are fixed in the sense that you cannot expect your reports and programs to
be corrected speedily (a relative term, agreed, but reports that I get before the deadline will
be corrected within a few days, reports that arrive later may take several months) if you hand them
in later. A stong deadline is 970331, if you have not completed the assignments by then
you are referred to the next time the course is given.
I strongly recommend you to try to complete the assignments before the exam; not only will you get your
credits earlier, working with the assignments is also an excellent way of preparing for the exam.
C++ is the preferred programming language. Exercises two and three must be written in C++ since
they involve using classes that are already designed and implemented.
In-depth presentation and coverage of connected concepts: F01 (961029)
Deadline: 961202
Purpose: to familiarize the student with fundamental computer graphics
concepts.
Your task
This exercise is described in a postscript document.
About AVS
On our Sun systems, AVS is started by the script
/opt/avs/bin/start_avs
which sets up required variables and starts AVS.
The file ~grafik/HT96/E1/avs is a copy of the script.
You can copy either original (can there be more than one original??)
to your own directory.
Geometries (*.geom files, *.scr) are found in
/opt/avs/data/geometry
(.scr files contain several objects).
Images (*.x files, for texture maps, etc.) in
/opt/avs/data/image
The file browser automatically starts in
/opt/avs/data
Currently only one AVS license is installed. More will be
available in the near future. I'll keep you posted.
If you have problems starting AVS you can try the following
command to start it:
/opt/avs/bin/start_avs -floating
In-depth presentation and coverage of connected concepts: F07 (961113)
Deadline: 970130
Purpose: to teach the student the elements of 3D viewing.
Your task
In this exercise you will use PHIGS or SPHIGS to simulate an intersection between two roads. The intersection
is a simple two-way intersection where cars are not allowed to change direction.
Use the program and Makefile in ~grafik/HT96/E2 as a starting-point. This program
implements the simulation and a few skeleton classes.
Your task is to supplement some of the classes (car and trafficlight) with graphics capabalities. Possibly
the best way to do this is to create new graphics classes which you can then merge (through
multiple inheritance) with the non-graphics counterparts to complete classes with the behaviour
you need. You also need to draw the roads: show 500 meters in each direction from the intersection
for instance. Cars enter into the simulation where the view starts (=500 meters from the intersection).
They may not turn at the intersection, neither are they allowed to overtake other cars (it is a single-file-in-each-direction road).
Each car has a maximum speed (defined as meters per time unit).
Your program should include a possibility to interactively (with the mouse) change viewpoint. One way of
doing this is to imagine that the cursor moves on an imaginary half-sphere over the intersection while
all the time looking (do cursors have vision??) towards the centre of the intersection
The user interacts with your program using the mouse as described above and with the keyboard. If any of
the following keys is pressed, the program should act:
- c/C: enter continuous simulation mode (as opposed to step-by-step mode).
- q/Q: quit the program.
- s/S: enter step-by-step mode and take one time step.
In addition, c/C and s/S both start the simulation if it is not started already.
The simulation is event-driven with the following three events (~grafik/HT96/E2/events.h):
- one time unit has passed (and the cars thus moved some meters if possible)
- a car comes into view
- the traffic light changes from green to red and vice versa
Implementation details
The program uses a coordinate system with the centre of the intersection in (0,0,0) and the
Z=0 plane on the ground, with Z increasing upwards towards the sky. For simplicity, the coordinate system
is assumed to be defined in meters. The roads should be in the direction of the X and Y axes, otherwise the cars will leave them (unless you rewrite the car class, of course).
We assume that the intersection is in a part of the world where cars drive
on the right (as opposed to left, not as opposed to correct) side of the road.
A few constants (in ~grafik/HT96/E2/constants.h) that affect the graphics (sizes and positions of the roads, trafficlights, and cars):
- RADIUS is the visible portion of the roads in each direction, the distance from the centre of the intersection to the edge of the visible window.
- The four trafficlights are placed TRAFFICLIGHTDISTANCE meters from the centre of the intersection in the direction of the road and zero meters from
the intersection in the other direction. This means that they must be placed
above the road.
- Cars must have a space of MINDISTANCE meters between each other, and are all
equipped with a sensational new engine which permits infinite acceleration (i.e. they either stand
still or move at top speed). In this simple model the distance between two cars
is measured from the centre of one car to the centre of the other; in other
words, MINDISTANCE includes the length of the car.
- All drivers are perfect: every car is driven along a perfectly
straight line, DISTANCEFROMCENTREOFROAD meters from the centre of the road. This distance is either negative or positive depending on the direction of
a particular car.
Run the program intersection to get a feeling about what happens during simulation (intersection produces only alphanumeric output).
Practical advice
Whether you choose to use PHIGS or SPHIGS is immaterial but I suggest you use SPHIGS:
it is simpler and you have access to the documentation in the textbook.
If you use SPHIGS
The complete implementation of SPHIGS is found in ~grafik/SPHIGS (SPHIGS is built on
SRGP whose implementation you can find in ~grafik/SRGP). For sample programs, consult
the files in the directory ~grafik/ExamplesSPHIGS. Use ~grafik/HT96/E2/Makefile
to compile and link your program: just add your own files.
If you use PHIGS
There's a Makefile in $PHIGSHOME/examples. Copy it, edit it, and use it to build your
program. Make sure that PHIGSHOME, XGLHOME, and LD_LIBRARY_PATH are defined
(see the file ~grafik/PHIGS/README.xxxxxx where xxxxxx is a date, for more information
on how to that). I have used a simpler Makefile (in ~grafik/PHIGS).
You can run, and perhaps steal ideas from, example programs in $PHIGSHOME/examples.
The directory contains both source code and executables and the file README.examples in
the same directory contains short descriptions of the programs. There is also a bunch of
PHIGS programs in ~grafik/PHIGS. This directory contains source code for the examples in
the PHIGS Programming Manual by Tom Gaskins, published by O'Reilly and Associates.
There's a directory for every chapter in the book. Programs in concepts have been compiled
and linked and thus exist as executables which you can run.
There is an on-line manual that you can use. The file .Answerbook in ~grafik/PHIGS tells
you what to do to be able to access the manual. Copy the file to your directory and change it
according to the instructions in the file. Log in on hassaleh (the manual only runs on that
machine) with telnet or login. Then enter the command source .Answerbook or, if you
have defined the required environment variables, /usr/openwin/bin/answerbook. Select
the menu SunPHIGS 3.0 Answerbook and you're off.
In-depth presentation and coverage of connected concepts: F08 (961114)
Deadline: 961209
Purpose: to teach the student how to create a simple user interface and how
to connect an application to a user interface
V is a portable (that is, it is available
for PC Windows, Mac, and X) C++ GUI framework. You
will be working with an X version based on the Athena widget set.
Your task is to build a user interface for the class Reg which handles a list of people. The classes Person and
Reg are predefined, declared in ~grafik/HT96/E3/person.h and ~grafik/HT96/E3/preg.h,
respectively. Corresponding object files (person.o and preg.o) are located in the same directory. You are not
allowed to modify these two classes.
Your interface must include buttons and/or canvases for at least:
- Display of one person
- Reading a register (the file ~grafik/HT96/E3/testfil can be used)
- Saving the register
- Browsing through the list (with Prev and Next buttons, for example)
- Editing a person's data
- Deleting and adding persons
- Graceful termination the program
Graceful termination includes confirmation and the possibility to save unsaved data.
You should use a menu pane with applicable standard menus (File and Edit in this case),
a command pane for browsing, and a text canvas pane for data display. You will also need a
modal dialog window for editing and adding persons.
Use ~grafik/HT96/E3/Makefile as a template Makefile for your application: paths to include files and
libraries are defined in this file.
In-depth presentation and coverage of connected concepts: F08 (961114), F13 (961128)
Deadline: 961216
Purpose: to give the student some understanding of a) how Motif applications are
designed, and b) how splines work.
Your task
In this exercise you will use Motif and X to define and manipulate a 2D B-spline curve in-
teractively. Your program interface should have at least the following functions:
- adding a control point
- removing a control point
- moving a control point
- terminating the program (a quit button)
It is important that you can create multiple control points and that moving control points is
done in a truly interactive fashion, i.e. the curve must change shape as you "drag" the control point from its previous location.
And when a new point is added, it should be possible to
manipulate the resulting curve segment before fixing the point.
You can use straight-line segments when displaying curves with less than 4 control points
and for the initial tests of the interface (B-spline curves will be dealt with later in the course
so if you start with them right away you will have to read ahead...(unless, of course, you are
already familiar with B-splines)).
Hints
You do not need to smart-code the display algorithm. It is quite OK to draw the whole curve
in the interactions. Use the GXxor function to display and remove the tentative curve. The
only data structures you will need are an array with the control points and an XPoint array
(do man XPoint to find out about that structure) to hold the points you are to draw.
One way of implementing the interface is: use a drawing area widget, click in it to add a
control point last in the sequence, click with mouse button two on an existing control point
to make it double (and a third time to make it triple), remove a point by dragging it out of
the window. Not required (but nice) functions include a possibility to add control points
anywhere in the sequence and a possibility to toggle between display of curve and display
of straight-line segments (or you can connect the control points with dashed lines).
You can draw black curves on white background (making double control points bigger) or
you can use colour (for the curve, and, in particular, for multiple control points).
Practical advice
There is an example program (interactive drawing in a drawingArea widget) in
~grafik/HT96/E4/drawMotif.c. In ~grafik/HT96/E4 you will also find a Makefile you can use
as a template, and an X resource file Draw
Remember that you can use man to get a lot of help about X and Xt functions.
Click here for
a brief description of Motif (version 1.1.x so it's not quite up-to-date)
widgets and their resources.
The Written Exam
If the mandatory assignments make up 50% of the examination, the written
exam obviously must take care of the other half. The exam consists of
10-15 questions about important computer graphics concepts. You are not
allowed to use any books, calculators, or notes during the exam. Write
brief answers to the questions; there's no reason why you should need more
than two or three hours to complete the exam if you are well prepared and
know the answers.
Important computer graphics concepts that you should be familiar
with are listed in this file
(with references to the textbook and/or
hand-outs). NOTE: check the date in the file to see whether it is
last year's version or if it has been updated for this year's course (since the
difference between the syllabi is infinitesimal, the older version covers most
of what will be treated this year).
Topics decidedly not in the syllabus of this year's course (some may have been
treated briefly at a lecture, some may be the topic of a hand-out - and most
are of more or less general interest) include:
- The postscript language
- Scan conversion of ellipses
Postscript versions of old exams with solutions (in some cases):
This year's instances (HTML versions):