Archive for May, 2006

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.

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.

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.

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.

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.

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.