Archive for the ‘cpsc465’ Category

Minimal Ray Tracer

Saturday, May 20th, 2006

Some code to accompany tonight’s lecture: a version of Paul Heckbert’s Minimal Ray Tracer from Graphics Gems IV.

I’ve updated the code to do the following:

  • compile with GNU C
  • output plain PPM
  • generate a 1024 by 1024 image instead of the tiny 32-pixel original

I’ve also included a JPEG version of the image, generated with ppmtojpeg,

If you want to experiment with changing the scene defined in ray.h, you’ll probably want to download NetPbm for Windows.

Assignment 10

Sunday, May 14th, 2006

If you didn’t finish Assignment 10, you can download assignment10.c as a starting point for Assignment 11.

Demos for tonight’s lecture

Saturday, May 13th, 2006

There are two demonstration program for tonight’s lecture:

You will need the texture mapping technique for Assignment 11.

Pixar’s On-line Library

Saturday, May 13th, 2006

I happened across this the other day: Pixar has made available an On-line library of technical papers. Many of them are probably a bit advanced, but worth a look if you’re considering further study.

Is this <hint>normal</hint> behavior?

Wednesday, May 10th, 2006

Have you noticed that the lighting calculations don’t seem to be affecting your windshield the same way they affect the rest of the car?

I wonder which part of the illumination equation isn’t being evaluated normally.

Material Colors

Wednesday, May 10th, 2006

Here’s a function to set the current drawing color, whether or not lighting is enabled:

void color(double r, double g, double b)
    float color[4] = { r, g, b, 1.0 };

    if (glIsEnabled(GL_LIGHTING)) {
        glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, color);
    } else {
        glColor3f(r, g, b);

Note that although the color can be set for GL_AMBIENT and GL_DIFFUSE separately, you’ll usually want them to be the same.

Alternatively, you could try reading about GL_COLOR_MATERIAL.

Chapter mismatch between HTML and PDF versions of the Red Book

Saturday, May 6th, 2006

It would appear that the HTML and PDF versions of the Red Book are different editions, with different Chapter divisions. The Chapter 12 you want is “Selection and Feedback”, not “Evaluators and NURBS.” The next chapter, “Lighting”, has the same problem.

Assignment 9

Friday, April 28th, 2006

Assignment 9 is available. Trust me — the assignment will be easier if you attend class and implement the version of the algorithm that we discuss.

Slides for tonight’s lecture

Saturday, April 15th, 2006

For the second half of tonight’s lecture, we’ll be looking at the Aliasing and Antialiasing slides in the ACM SIGGRAPH 1993 Education Slide Set. There are some visual effects here that I wouldn’t be able to draw on a whiteboard to save my life.

A note on doing the work yourself

Friday, April 14th, 2006

I realize that in Assignment 6 and Assignment 7 where we deal with well-known algorithms, it will be especially tempting to use someone else’s implementation — they are, after all, readily available on teh interwebs.

Note, however, the following:

  1. Turning in code you didn’t write yourself is Academic Dishonesty.
  2. Using someone else’s pseudocode is fine, as long as you credit the source.
  3. If you do use someone else’s pseudocode, make sure you understand what it does.
  4. There will be at least one question on each algorithm on the Final Exam.
  5. If you take the time to implement the algorithm yourself, you will be more likely to remember it well enough to earn full credit on the exam.

Remember also that if you are struggling with an algorithm, you are allowed to work on homework assignments with a partner.

Hint: pick a partner who’s smarter than you are.