Summary
This chapter covered a better method for speeding up the photon-mapping rendering process, which involved attaching the KD Tree to the application environment. Note that the KD Tree isn't equally balanced because photons scatter randomly in the scene. Light scatters in a proportional manner because of occlusion , so balancing the KD Tree is fast at times and slow at others. The KD Tree is essential to photon mapping because searching through a linear (one-dimensional) list isn't optimal for a 3D algorithm like photon mapping. As you've seen, you've increased the speed for retrieving the nearest neighbors by using the KD Tree for photon.txt . The KD Tree is a two- or three-dimensional algorithm best suited for points (or photons) in a multidimensional environment. Using a spatial subdivision algorithm is a must when storing and retrieving photons.