Term Project

Hello everyone.

My project topic was bidirectional path tracing. The project is not completed and results are not correct. However, I will share my outputs after explaining the technique and what I have done, briefly.

In path tracing, we shoot rays from the camera and compute their contribution to the final image. In order to make a contribution, a ray must reach to one of the lights in the scene. In light tracing, rays are sent from a light and their contribution can be seen on the image if a ray reaches to the camera eventually. Bidirectional path tracing (BDPT) , which is a superset of light tracing and path tracing, incorporates both of these techniques. In BDPT,
  • Light and eye subpaths are sampled using light tracing and path tracing, respectively. Let NL and NE be the number of vertices in each subpath.
  • Then, a set of paths is constructed by using the first s vertices of light subpath and the first t vertices of eye subpath for each (s, t) pair, such that s<=NL, t<=NE, and s+t>=2. Note that the path is not valid if (s-1)th vertex of light subpath is not visible from (t-1)th vertex of eye subpath.
  • After that, for each path, the unweighted contribution and MIS(multiple importance sampling) weight of the path is calculated. The contribution of the path to the final image is obtained by multiplying these two terms.
There are also some other details like using Russian roulette to terminate paths but I will not go into details here. If you are interested, you can read the details in Eric Veach's PhD thesis, "Robust Monte Carlo Methods for Light Transport Simulation" (1997).

In azimuth, I implemented most of the steps above. However, there are some parts that are missing. For example, if t is equal to 0, the contribution of the path is ignored. In other words, azimuth does not support light tracing. Another issue is that the calculation of unweighted contribution is faulty if both s and t are greater than 0 (Equation 10.8 in Veach's thesis).

In order to use BDPT, I have added a new integrator type to our scene file format. If the value of <Integrator> tag is "BidirectionalPathTracing" (without quotes), then the scene is rendered using BDPT.

For comparison, I also rendered them using path tracing. Interestingly, path tracing took longer to render in some scenes. In general, BDPT is said to be more time-consuming compared to path tracing if the number of samples is the same. In azimuth, materials are allowed to scatter incident rays just once if the scene is rendered with BDPT. If path tracing is used, however, materials can scatter more than one ray based on their properties. For instance, if both diffuse reflectance and mirror reflectance are defined for a material in the scene, then we will scatter two rays from the surface if we are using path tracing. But if we are using BDPT, one of those reflectance values are selected randomly and only a single ray is scattered from the surface. Similarly, for dielectrics, we choose to refract or reflect the incident ray randomly based on reflectivity. This difference between BDPT and path tracing might be the reason of that unintuitive running times. Also, images rendered with BDPT are more noisy, since it is not a complete implementation of BDPT.

Below, you can see the results.

cornellbox_jaroslav_diffuse_area (512x512, 100spp, BDPT)
67.376183s 

cornellbox_jaroslav_diffuse_area (512x512, 100spp, PT)
62.511620s

cornellbox_jaroslav_glossy_area (512x512, 100spp, BDPT)
49.619263s
EXR

cornellbox_jaroslav_glossy_area (512x512, 100spp, PT)
61.624660s
EXR

cornellbox_jaroslav_glossy_area_small (512x512, 100spp, BDPT)
101.588516s
EXR

cornellbox_jaroslav_glossy_area_small (512x512, 100spp, PT)
153.150787s
EXR

cornellbox_path_importance_100 (750x600, 100spp, BDPT)
448.833344s
EXR 

cornellbox_path_importance_100 (750x600, 100spp, PT)
626.889648s

Thanks for reading!

Comments