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.
Now that you know what you are going to be doing, we'll get you setup
- Copy /usr/class/cs348b/software/lrt/lrt.tar.gz to your
- Type gunzip lrt.tar.gz in the directory with
lrt.tar.gz. The result is a file named lrt.tar.
- Type tar -xvf lrt.tar. This will extract all the files
you need into a new directory called lrt
- Compile lrt for the system you intend to use. We
have provided a set of Makefiles for irix (sgi), sun and linux.
Once you have successfully compiled lrt,
try rendering several images. Experiment with the
following RIB files which are available in
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
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.
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
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.
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:
0 - Little or no work was done
* - Significant effort was put into the assignment, but not everything
** - The algorithm you implemented was functionally complete;
it passed all of our tests.
*** - The algorithm was more than twice as fast as the original, basic
Copyright © 2001 Pat Hanrahan