|
I am implementing a path tracer with photon map to do
physically based realistic image synthesis. The renderer
utilizes spectral color representation to render more accurate
image. Considering implementing a ray tracer has been one of
my longing goals, I must say I'm glad to at least have something
to show, or has made the first step toward this area. I must
also thank Ken and
espectially Brian for
his initiative to offer the seminar and forcing each of us
to produce something, often that's all you needed to get started.
Besides reading books and papers, the discussion with other
members (Brian, Rob, Attila, Taylor, etc.) has been invaluable.
Presentations for Photorealistic
Image Synthesis
Progress with my path tracer
It always seems to me that all the ray tracers in this world
are cool, just look at all the cool images they generate. Then
I realize it starts with something very simple, a sphere.
 |
June 18, 2004
Bounding volume hierarchy is working. The scene on
the left has 10000 spheres and is rendered at 4 samples/pixel
without
photon tracing. Instead, the color bleeding is caused
by 1 bounce of path tracing. Render time is 2 minutes
46 seconds.
The algorithm is decribed in Fundmentals of Computer
Graphics by Peter Shirley. The objects are divided
by X, Y, Z axises recursively. Each bounding
box is
divided
to
left and
right nodes. Each ray is checked with the parent bounding
box, if it intersects, we check its left and right
children recursively. If we reach a leaf node, we check
intersection with the actual scene object bounded by
that bounding box.
 
|
 |
June 08, 2004
Participating media. I run into some problems on rendering
dielectric objects. So the sphere shown here is not
quite right. The volume is isotropic and homogenous.
This is the simplest case. We can define absortion
coeffection and scatter coeffections in this case.
The isotropic phase function is a constant (1/(4*PI)).
The direct lighting component is computed directly
using ray tracing. The indirect component is rendered
using photon map (direct estimate of radiance using
photon map).
Rendering time is 1 hour 12 minutes. Should be faster,
still work in progress. |
 |
June 08, 2004
Shinny metal balls and box. Notice the caustics reflected
by the mirror like surfaces.

|
 |
May 21, 2004
After some trials and errors, I found where the problems
are and fixed them (thanks to Matt
Pharr for clarifications)! So here is what I am
fairly confident to be the "correct" image.
Finally I am able to move on to something new! This
image is rendered with 16 samples per pixel, 16 shadow
rays and 20 indirect samples per primary ray. Render
time: 2h 40min. The image in OpenEXR format is here: box42.exr

|
 |
May 17, 2004
More sampling. I also implemented the XYZ conversion "correctly," but
I am still not 100% sure.
|
 |
This one is rendered using path tracing, 64 samples/pixel.
You can see the noise but I think it's getting closer
to be correct. I also found some mistake in my cosine
distribution hemisphere random vectors. Fixed in later
renderings.
|

|
These are closer to what I think would be correct.
The images are identical except one was rendered at 1
sample/pixel, another at 9 samples/pixel.
But I am sure there are plenty improvements I can
make...I am still working on it!

|
 |
Somewhere in between, after some discussions with
Brian and Rob, I realize some of the mistakes I made.
The odd colors are due to color conversion error (exceeding
RGB values). The last two images on the right are separate
photon calculations for direct illumination and indirect
illumination. I am only using the indirect illuniation
from photon mapping. The direct illumination is still
calculated by the path tracer.
  
|
 |
These are photons! I was trying to see whether my
photons are stored correctly and how the power is bouncing
around. Ineresting?

|
 |
I bet you have never seen the famous Cornell box in
such colorful ways. Trust me, these are special effects
I purposely put in. Photon map, what a wonderful thing!
One good thing about Henrik
Wann Jensen's Realistic
Image Synthesis Using Photon Mapping, is that
the source code in the last few pages of the book
actually work. All you have to do is type it in and
boom, it works. Everything else in that book is just
a collection of his papers binded together. Hmm...,
it's a good book, although missing some details,
which could be helpful if you are not one of his
students.
  
|
 |
After reading some of Peter
Shirley's SIGGRAPH course notes on direct illumination,
I am quite certain that I have that part nailed. What's
probably missing is a good BRDF. I am not sure what
BRDF I should use for the walls of the Cornell box.
Assuming it's perfectly diffuse, the Lambert term is
some constant. Is it 0.5, 1, or something else?
As you can see from the noise, we do have indirect
illuminations, but I am not sure whether I'm computing
it right. Nonetheless, the image on the right was sampled
at 512 samples/pixel, took about 8558.58 seconds to
render. In between, I have switched numerious clor
conversion methods, various formulars for calculating
illuminations. The result isn't that great.
I think I'm going for photon map now.
  
|

|
Disasters do happen, often. These are the wrong images
I produced, the noise are due to the random walk path
tracing algorithm. And the colors look odd. The problem
is somewhere between Spectral to XYZ, XYZ to RGB, or
both.
Notice how I have set up the Cornell box wrong, till
I realize we are facing in positive directions acording
to their
data. The soft shadow is free with area light sources,
as expected.
Then I spent at least one full day to try to improve
(fix) the path tracer.
   
|
 |
Here is a picture after I implemented spectral color.
Even now (after 4 days), I still don't know whether I
am implementing this right. But anyway, this picture
looks OK, but I can assure you that the colors are wrong,
even if it looks right. The attenuation term for the
light is the inverse of the squared distance (which is
physically correct). But I am calculating the direct
lighting wrong. Basically I missed one of the two cosine
terms and the area of the light.
|
 |
Now you can tell I have not only a sphere intersection
test working, but also implemented triangle intersection
test. Both are the fastest methods I can find (steal).
Also implemented tracing shadow rays, surprisingly simple.
|
 |
This is The first image I produced with
my ray tracer. Isn't it beatiful?
At this point I have a simple GUI set up, with my image
IO ready. I also have a set of classes I always used for
graphics projects, such as vector, point, etc. These classes
are based on Ken's
C++ source library except they are updated to use current
C++ STL.
|
|