CMSC 435/634: Introduction to Computer Graphics

Assignment 5

Lighting

Due April 22, 2004

The Assignment

For this assignment, you will extend your ray tracer from assignment 4 to shade surfaces according to their material properties and the positions of the lights and camera. You will add the effects of ambient, diffuse and specular illumination.

Input file

A sample input file is provided in ~olano/public/435/assn5/spheres.sph. The input is a simple extension to the input format from the previous assignment. There is a new section between the image plane distance and geometry listing details of the lights in the scene. This section contains the following information:

ambientIntensity pointLightCount
pointLightIntensity pointLightX pointLightY pointLightZ
pointLightIntensity pointLightX pointLightY pointLightZ

You will also need to make use of the extra information possible on the geometric element lines. Recall that a sphere could include 13 parameters:

sphere x y z radius r g b kd ks e kr kt ir

For this assignment, you will need to use kd as the coefficient for both ambient and diffuse shading, ks as the coefficient for specular shading, and e as the specular exponent.

Extra credit / 634

For extra credit (required for students registered for 634), use an environment map for rays (direct, reflected, or refracted) that leave the scene. Six environment map ppm files (converted from jpg files found on developer.nvidia.com) are also in the ~olano/public/435/assn5 directory.

Extra credit

After you have environment maps and reflection working, you may get additional extra credit by adding Fresnel reflectance coefficient computations. You may use either the real Fresnel formula for unpolarized light, or the Schlick approximation in the book.

What to turn in

Turn in this assignment electronically as 'cs435 Proj5' using the submit mechanism:

    submit cs435 Proj5 [files...]

The usual assignment boilerplate applies as always -- submit all source files; comments are your friend and ours, they're a good idea and increase your chances of partial credit since they help us understand what you were trying to do. All work must be your own and developed from scratch for this assignment. You may discuss concepts but not code with your classmates. Use of any "borrowed" code is considered cheating and will be treated accordingly. We must be able to build and run on the GL systems to grade. You should use C or C++ for your code, but since no external libraries are used for this assignment, developing on another OS and porting back to GL/Linux should not be too difficult (but do leave some time to do that port).