Final Project Report

best5
best6


Flow chart

    Distribute photons:
            Volume photons: Volume photons consists of two parts: global volume photons and caustic volume photons. A global volume photon traced within a participating medium can either pass unaffected through the medium, or it can interact with it (be scattered or absorbed). The possibility of interaction depends on how long a photon is traced in the medium without interacting with medium.  The longer a photon is traced, the larger possibility is. We use a Russian Roulette to decide whether a photon interact with the medium or not. If a photon interacts with the medium, another Russian Roulette is used to decide whether a photon is absorbed or scattered by comparing the scattering albedo. The new direction of a scattered photon is chosen using Schlick phase function.  Caustic volume photons are traced in the same way except that a photon is shot to specular objects intensionly. The photon interacts with the medium only after its corresponding photon ray intersects with specular objects at least once.

volume
causticvolume
volume photons
volume caustic photons


            Surface photons: Surface photons are distributed as in lab4

direct
indirect
caustic
direct photons
indirect photons
caustic photons

    Rendering:   
            In the second pass, the image is rendered using the photon maps.  To incorporate  participating media, we need to consider those rays that pass through a medium. The radiance of a ray traversing a participating medium is computed by an adaptive ray marching algorithm. In each step, the radiance from previous point is attenuated and the contribution from in-scattering within the step is added, corresponding to following fomula.
            raymarch
            

Implementation

              Here is the pseudocode for distributing volume photons.

               while not enough photons
                    sample lights to obtain a photon ray from light to scene
                    while the photon ray has energy
                        if the photon ray in a participating medium
                                 using Russian Roulette to decide whether the photon ray interacts with the medium     
                                 if it does
                                    store the photon into the volume photon map
                                    using Russian Roulette to decide whether the photon ray is scattered or absorbed
                                    if it is scattered
                                        using Phase function to sample a new direction for the new photon ray
                                 else
                                    march a random distance along the photon ray'
                        if the photon ray intersects with some object
                                 According the surface brdf, sample a reflection or transmission direction to generate a new photon ray.

                  
                  The possibility that a photon ray interacts with a participating medium is interact, where k is the extincition coefficient defined as sum of absorption and scattering coefficient, xs the origin of the photon ray.
                    We use the Schlick phase function to scatter the photon ray in the participating medium. the function is: pdf, the corresponding importance sample is given by: sample
, where t = cos(theta), theta is the angle between the incoming and scattering ray. As the following figure shows, Positive k gives forward scattering and negative k gives backward scattering.
 g

   
     
           
            Rendering
           
            Here is the pseudocode for rendering
   
            For each ray from eyes to image plane
                    If the ray is in the participating medium
                            adaptively march a small distance along the ray
                            calculate the attenuation coefficient at this segment
                            collect volume photons around this segment
                            compute the radiance of these photons along the ray direction
                            take the multiplication of this radiance and the attenuation coefficient as the contribution of this segment
                    If the ray intersects with an object
                            collect the surface photons
                            compute the radiance at the intersection point along the ray direction
                            calculate the attenuation coefficient at this segment
                            take the multiplication of this radiance and the attenuation coefficient as the contribution of this point
             
                           

            Adaptive ray marching: As the following figure shows, the ray is divided into small segments. The length of the small segment is recursively halved if the currently computed radiance differs too much from the radiance in the previous point. In addition, if the length is recursively doubled if the radiance of previous three points does not differ too much.

        

Some hints using lrt photonmap

 The photonmap part of lrt has a big problems. After the photon map is established, lrt calls the function resamplePhotons to delete the dark photons and increase the contribution of the bright photons . However this step makes the image very noisy as following figure shows. In addition, in order to get the high quality image, we should use the finalgathering option.



using resample photon and without final gathering
without resample photon and final gathering without resample photon and using final gathering


Reference:

Henrik Wann Jensen and Per H. Christensen: "Efficient Simulation of Light Transport in Scenes with Participating Media using Photon Maps". In Proceedings of SIGGRAPH'98, pages 311-320, Orlando, July 1998

Philippe Blasi, Bertrand Le Saec and Christophe Schlick: "A Rendering Algorithm for Discrete Volume Density Objects". EUROGRAPHICS '93
Volume 12, (1993), number 33