Surface Shader (at last)

        if (kt > 0) {
            // Add refraction code here
        }

        r = (r > 1f) ? 1f : r;
        g = (g > 1f) ? 1f : g;
        b = (b > 1f) ? 1f : b;
        return new Color(r, g, b);
    }
}


That's basically all we need to write a ray tracer. Compared to a graphics pipeline the code is very simple and easy to understand. Next, we'll write a little driver applet.
Lecture 19   Slide 24   6.837 Fall '00