Homework 1

Assigned: Tuesday, April 10, 2001
Due: Tuesday, April 24, 2001

There are two objectives for this first assignment. The first is to introduce you to lrt and RenderMan. The second is to add support for ray tracing height fields to lrt. Height fields are functions z(x,y) defined as a 2D array z[iy][ix]. A common use of height fields is to represent digital terrain models.

Step 1

Now that you know what you are going to be doing, we'll get you setup with lrt:

Step 2

Once you have successfully compiled lrt, try rendering several images. Experiment with the following RIB files which are available in /usr/class/cs348b/rib. To render an image type lrt teapot.rib. These RIB files are setup to produce TIFF image files. Display these with your favorite image viewer.

Take a look at these files. You will see commands to set the camera, lights and surface properties, as well as to create and position geometric primitives. The commands in the files should be relatively self-explanatory. For more detail, check out the documentation under RenderMan Resources for information about the syntax and available commands in RIB files. Be careful though: not all commands are implemented in lrt.

Step 3

Read the lrt book. The first chapter introduces you to literate programming, the second gives an overview of the system, and the next few chapters describe basic geometry, geometric primitives, and acceleration structures. Before starting the assignment, make sure you understand the Section on heightfields and the section on uniform grids.

Step 4

Finally, you are ready to start the programming part of the assignment, which is to implement an efficient ray-heightfield intersection algorithm. The version of lrt that you have compiled contains a sample implementation that will render height fields.

We also provide several RIB files. To render these type:

lrt terrain.opt hf4x4.rib
lrt terrain.opt hf64x64.rib
lrt terrain.opt hf200x200.rib

The larger resolution ones obviously take longer to render.

The sample implementation, however, does not ray trace the height field directly. Instead it converts the height field to a a triangle mesh. The triangle mesh is inserted into the uniform 3D grid. Study the section on height fields in the lrt book, and familiarize yourself with the code in heightfield.cc and heightfield.h. You should be able to do this assignment by only modifying these two files.

Implement an algorithm that ray traces the heightfield directly. When the height field create method is called, build your own data structure. In your direct ray tracing implementation, pay attention to efficiency. Hint: Consider tracing rays through a 2D uniform grid.

Grading

Turn in your finished homework using the cs348b submit script:
Make sure you hand in all your source code, a Makefile, and a README file. The README should contain instructions for compiling and running your code, and a description of anything non-intuitive you've done. Please do not submit any executables or object (.o) files. We'll be building your submissions ourselves, and those just take up space.

This homework, and all subsequent programming assignments, will be graded according to the following system:

Copyright © 2001 Pat Hanrahan