# CS348b Final Project: Parametrized Adaptive Shooting of Photon Rays for Controlling the Appearance of Caustics in Water

## Additional Results:

My idea for my part of the project was to investigate the fesibility of using local curvature information at points on a specular surface (water, in our case) along with some user-defined parameters to control the apperance of caustic effects in a scene.  I also hoped that the use of this information might lead in some cases to more efficient image computations.  The two images below, which use a simple sinusoid for the shape of the surface of the water, illustrate the basic concept:

My method creates a pdf for the water's surface, weighting convex-up regions more heavily than concave-up regions.  At each convex-up grid square, it calculates the probabilty weight based upon an idealized spherical lens tangent to the water's surface.  Using the divergence of a sampling to three surface normals within the grid square to calculate a radius of curvature for the lens, the method both computes the location of the sphere's center and, with the appropriate indexes of refraction, the focal point for the lens.  It then traces a probe ray into the underwater portion of the scene along the vector from the sphere's center toward the focal point and finds the hit point where this ray first intersects something.  The distance (normalized by the sphere's radius) between this hit point and the computed focal point then gives the method a measure of how well focused the lens is and therefore how likely light hitting the corresponding grid square is to contribute to a nice caustic.  The method uses a Gaussian in this distance to assign an unnormalized probability weight to the grid square, and the standard deviation of this Gaussian is the method's focussing parameter.  In the image above on the left, this focussing parameter is set to 1.0, giving a very broad band of light.  Setting the focussing parameter to 0.1 gives the much sharper caustic shown in the image on the right.

The images below show the effect of the focussing parameter for the same scene as above but with a more chaotic water surface.  From left to right, the focussing parameters used are 1.0, 0.1, and 0.05.  (The strange apperance of the water comes from scaling up the amplitude of low-resolution surface data in order to get sufficient curvature for focussed caustics.  The 1,000 x 1,000 high resolution water surface used in our final group image was unwieldy for such comparison renders.)

All of the images above used only 40,000 caustic photons, substantially less than the 1,000,000 we used to obtain nice caustics for the final group image we produced without using my technique.  40,000 photons seemed to be enough to bring out the most tightly focussed caustics in this scene.

Besides the focussing parameter, my method also gives the user control over the resolution of the pdf used for sampling incoming photon rays.  A lower-resolution pdf of course requires less time to compute and less time to sample from.  All of the images on this page that use my method were produced with a 402 x 402 pdf for a 64 x 64 resolution water surface.  The time required for computing a higher resolution pdf when working with our 1000 x 1000 water surface data was much more noticable, but not prohibitive.  My method may provide computational advantages when the water surface is slowly varying and the pdf can be small because my method can represent the brightest caustics with fewer photons.  These advantages will become penalties if the pdf must be made large in order to deal with high frequency variations in the height of the water.

Conclusions and Directions for Future Investigation:

The drawback of my method which ultimately made it unsuitable for use with our final group image can be seen in the next pair of larger images:

Although my method both renders the brightest caustics in a scene with fewer photons than the default implementation and gives the scene designer control over how focussed those caustics should be, it also turns out also to eliminate many of the subtle variations in light distribution that come from unfocussed regions of the surface and that add crucially to a scene's sense of realism.  The first image above is rendered with pbrt's default implementation using 500,000 caustic photons and 50,000 indirect photons.  The second is rendered with my implementation using 200,000 caustic photons, 20,000 indirect photons, and a focussing parameter of 0.05.  The brightest caustic in the first image runs from the left of the manta ray up through the rocks to under the dolphin's nose.  The second image shows that my method successfully picks out this caustic.  However, we also see that the dimmer caustics to the right of the manta ray are almost completely lost.  These can be restored somewhat by using a larger focussing parameter and more photons, but this begins to reduce the computational advantages of the method.  In future work, it may be possible to instead retain dimmer caustics by doing further processing on the pdf, emphazizing areas which are relatively more focussed than their neighbors rather than just emphasizing the areas which are the best focussed in the absolute sense.

Although I was not able to produce results that were visually pleasing enough to be included in our final group image, I believe the work shown above demonstrates that it is indeed possible to use a focussing parameter and local curvature information from the shading normals of a specular surface to vary the apperance of caustics in a scene in a useful way.  With the development of a pdf that takes into account relative rather than absolute focus and that adaptively weights concave-up regions of the surface based upon radii of curvature, it may be possible to give scene authors the ability to vary the apperance of their caustics along a continuum between what is seen in the first and second images immediately above, providing them with a valuable new degree of artistic control.