Pinhole Camera

Implement a pinhole camera, as described in Chapter 9 of your textbook. Download these zip files (which include Pinhole.java). You will need to do make a few modifications to your existing files from the bare bones ray tracer.


Geometry Files

The most universal surface representation is the triangle mesh, but there are a large variety of file formats that store a triangle mesh. I ask my students to write code to read in a file format called SMF (simple model format). Here is a short description of the SMF file format by Bradley Jones that you could provide your students. Here is a collection of SMF mesh models by David Breen.

Write a read_smf_file method in raytracer.GeometricObject.Compound that reads in a triangle mesh from a SMF file. This method should take the file name as an argument, and handle all the file I/O. It should first read in all the vertices and store them in a Mesh. Next it should read in the triangle indices. For each row of triangle indices, the method should create a FlatTriangleMesh and store it in the Compound Vector objects. It should also compute the normals for each triangle face, using the compute_normal method in the TriangleMesh class.


Create an image

Create a scene with at least one sphere and one triangle mesh. The triangle mesh should not be a sphere or a cube.

Use constant coloring to shade the objects, i.e., mark the pixels that intersect your objects with one color, and mark the remaining pixels with a background color.

Turn in a screenshot of your 512 x 512 image (original.jpg). Here is a smaller example of what you might create:


Finally, create four 512 x 512 images that have obviously had their viewing system modified:

You should turn in your code for creating your ORIGINAL image. Then in your readme, please include the code you modified for creating the above four images.
Last modified: Thu Mar 10 11:01:17 MST 2011