Chapter 13. Advanced Searching
Now that you understand the photon-mapping algorithm, you need to find ways to improve its efficiencyto optimize it. Currently, you're using an array to store photons . Arrays, however, are poor candidates for indexing data. In the photon-contribution method, traversing through an array to find the nearest photons around the point of intersection is a very slow task. This is because you need to begin searching the first element of the array and move forward. Sometimes, however, the relevant photons in the photon map are located at the end of the array, so moving through each unimportant ele-ment is really a waste of time. This chapter therefore focuses on a better method for retrieving photons when finding the radiance estimate.