Environment Light Importance Sampling - cmu462/Scotty3D GitHub Wiki

A pixel with coordinate ![height=15px](https://raw.githubusercontent.com/wiki/cmu462/Scotty3Dmedia/environment_eq1.png|height=15px]] subtends an area media/environment_eq2.png on the unit sphere (where media/environment_eq3.png and media/environment_eq4.png the angles subtended by each pixel -- as determined by the resolution of the texture). Thus, the flux through a pixel is proportional to [[media/environment_eq5.png). (We only care about the relative flux through each pixel to create a distribution.)

Summing the fluxes for all pixels, then normalizing the values so that they sum to one, yields a discrete probability distribution for picking a pixel based on flux through its corresponding solid angle on the sphere.

The question is now how to sample from this 2D discrete probability distribution. We recommend the following process which reduces the problem to drawing samples from two 1D distributions, each time using the inversion method discussed in class:

Given the marginal distribution for ![height=15px](https://raw.githubusercontent.com/wiki/cmu462/Scotty3Dmedia/environment_eq9.png|height=15px]] and the conditional distributions [[media/environment_eq10.png) for environment map rows, it is easy to select a pixel as follows:

  1. Use the inversion method to first select a "row" of the environment map according to height=15px.
  2. Given this row, use the inversion method to select a pixel in the row according to height=15px.