Programming Assignment 3: Photon Mapping
Due on Sun, Oct 5 at 11:59PM
Overview
In this assignment you will implement photon mapping, an algorithm for
image synthesis with global illumination. The following is a list of
features that you may implement -- the features in bold face are
required, and the others are optional. In addition to implementing
these features, you should submit an image generated by your program
to the art contest. The winner will get extra credit and a note on
the course web page.
Phase 1: Photon Tracing:
- Photon emission:Implement code to emit photons in random
directions from every light source in a scene. The total number of
photons emitted for each light source should be proportional to the
power of the light source (so that each photon carries approximately
equal power), and the distribution of photons should be proportional
to the power in each direction -- e.g., for spot lights
(section 2.1.1 in Jensen01).
- Photon scattering: Trace photons via reflections and
transmissions through the scene. At each ray-surface intersection,
randomly generate a secondary ray along a direction of diffuse
reflection, specular reflection, transmission, or absorption with
probability proportional to kd, ks, kt, and (1 - kd+ks+kt), respectively
(section 2.1.2 in
Jensen01).
- Russian Routlette: At each surface intersection, terminate rays
with probability p (e.g., p=0.5) and multiply the power of
surviving rays by 1.0/p (section 2.1.2 in
Jensen01).
See section 8.5 of these
siggraph course notes for details.
- Photon storage: Store photon-surface intersections in a kd-tree,
retaining the position, incident direction, and power of each photon.
(section 2.1.3 in Jensen01).
You can use the R3Kdtree class in R3Shapes to implement this feature.
- BRDF importance sampling: Select the directions of reflected
and transmitted rays with probabilities proportional to the Phong BRDF of the
scattering surface. See Jason Lawrence's notes for details.
- Multiple photon maps: Implement separate photon
maps for global (L{S|D}*D) and caustic (LS+D) ray paths
(section 2.1.5 in Jensen01).
- Photon map visualization: Visualize photons stored in your photon map(s) --
e.g., show positions, normals, and powers of photons.
Phase 2: Rendering:
- Camera ray tracing: Generate a ray(s) from the camera eye
point through each pixel. Trace them through the scene with
reflections and transmissions at surface intersections -- i.e., at
each ray-surface intersection, randomly generate a secondary ray along
a direction of diffuse reflection, specular reflection, transmission,
or absorption using importance sampling. (section 2.4 in Jensen01).
- Radiance estimation: Use the kd-tree to find the N closest
photons for each ray-surface intersection. Estimate the radiance traveling
along the ray towards the camera from the power of those photons.
(section 2.3.1 in Jensen01).
- Pixel integration: Trace multiple rays per pixel and
average the radiance computed for all rays to estimate the radiance to
store in the output image for each pixel. Compare the results with
different numbers of rays per pixel (N).
- Ray tracing visualization: Visualize ray paths traced from the
camera -- e.g., show line segments between the camera and successive surface
intersections for a random sampling of rays.
Options:
- Filtering: Implement disk, cone, and/or Gaussian filtering methods
for weighting photons during radiance estimation and compare the
results of different methods. (section 2.3.2 in Jensen01).
- Participating medium: Implement volume photon
maps that represent scattering of participating medium (e.g., fog)
(sections 2.1.4 and 2.3.3 in Jensen01).
- Projection maps: Use projection maps to sample photons leaving light sources
in the directions of scene geometry (section 2.1.1 in
Jensen01).
- Anything else: Extend your path tracing to handle subsurface
scattering, motion blur, or anything other feature described in
Jensen01.
To get started, you can use the code in (cos526_assn1.zip). This C++ code provides
the basic infrastructre for reading scenes, computing ray
intersections, etc. It also provides a simple program (scnview) for
viewing scenes using OpenGL. You will probably need to augment this
program to include command line arguments of your own to turn on and
off specific features and/or provide parameters for specific
applications.
The skeleton code is able to read scenes in a simple scene file format, This format was created to
provide the features required by this assignment -- a simple scene
graph along with materials, lights, and cameras. We provide several
scenes in the input subdirectory of the zip file
that you can use to test basic functionality of your program. However,
these scenes are not enough to test all the interesting lighting
effects your program should demonstrate. So, you should design your
own scenes for testing/demonstration and include them in your writeup
file.
What to Submit
You should submit one zip file named
PUID_cos526_assn1.zip
(i.e. funk_cos526_assn1.zip) with the following
internal directory structure:
PUID_cos526_assn1/
writeup.html
(your writeup, see the description below)
Makefile
(a unix Makefile useful for making output files from input files)
input/
(all the input data for the examples in your writeup)
output/
(all the output images for the examples in your writeup)
art/
(all images submitted for the art contest)
src/
(the complete source code)
writeup.html
should be an HTML document demonstrating
the effects of the features you have implemented. There should be one
"section" per feature. with a brief description of what you
implemented and some images showing your results. For all features,
it is sufficient to include images of your input and output -- you do
not have to submit the mesh files. Wherever possible, you should show
results for at least two sets of inputs.
The src
directory should have all code required to
compile and link your program (including the files provided with the
assignment), along with a Visual Studio Solution file and a Makefile
to rebuild the code.
Please submit images in JPEG format to save space. Also, to
further save space, please remove binaries and backup files from the
src directory (i.e., run make clean
) before submitting.
Useful resources
- Global Illumination using Photon Maps, Henrik Wann Jensen, 1996.
- Realistic Image Synthesis Using Photon Mapping, Henrik Wann Jensen, Second Edition, 2012.
- Notes by Zack Waters, WPI.
- Photon Mapping Assignment Writeup, Abuhair Saparov, COS 526, Fall 2012.
- Photon Mapping Assignment Writeup, Edward Zhang, COS 526, Fall 2012.
- Photon Mapping Assignment Writeup, Ohad Fried, COS 526, Fall 2012.