Hemisphere Sampling or Spherical Sampling: A Small Detail of Importance Sampling the Poisson Kernel in Walk on Boundary

In the world of Monte Carlo methods for PDEs, one of my favorite mathematical coincidences is the similarity between the Poisson kernel and the projected solid angle used in ray tracing. This coincidence makes it possible to perform low-variance sampling in walk on boundary and walk on stars by using direction sampling similar to that in stochastic ray tracing.

As an example, for the pure-Neumann case of walk on boundary we need to run the following Monte Carlo estimator:

\hat{u}(x_i)=-\frac{2\frac{\partial G}{\partial n_y}(x_i, x_{i+1})}{p_1(x_{i+1}\mid x_i)}\hat{u}(x_{i+1})+\frac{2 G(x_i, x_{i+1}')}{p_2(x_{i+1}'\mid x_i)}\bar{q}_\text{N}(x_{i+1}').

Here, the coefficient of the first term:

-\frac{2\frac{\partial G}{\partial n_y}(x_i, x_{i+1})}{p_1(x_{i+1}\mid x_i)} = \frac{\frac{r\cdot n_y}{2\pi r^3}}{p_1(x_{i+1}\mid x_i)},

can be importance sampled using directional sampling. One caveat is that, unlike Monte Carlo ray tracing, this term contains no geometric-visibility factor, which means we must consider all intersections of a ray in both the forward and backward directions, rather than only the nearest forward intersection. In fact, the same issue occurs in walk on stars: if the radius of the star-shaped region is not constrained by a closed silhouette point query (CSPQ), these extra intersections can appear, and that is precisely the motivation for introducing CSPQ in walk on stars.

In WoBToolbox, there is a seemingly puzzling step when sampling this term: the author uses uniform hemisphere sampling to generate rays, and this hemisphere is not aligned with the geometric normal of the boundary.

Mathematically, this choice is indeed well justified: the PDF of hemisphere sampling is exactly \( 1 / 2\pi \) times the projected solid angle (in Cartesian coordinates), which perfectly cancels out the constant in the numerator of the above formula. The remaining question, however, is, why use hemisphere sampling instead of spherical sampling?

In fact, uniform spherical sampling works perfectly fine. However, under our sampling setup — where we consider all intersections along both the forward and backward directions — the effective PDF of uniform spherical sampling also becomes \( 1 / 2\pi \). This happens because, in uniform spherical sampling, each sample direction is effectively counted twice, once for each orientation.

To summarize, in walk on boundary, we can safely use uniform spherical sampling, as long as we treat its PDF as \( 1 / 2\pi \), just like in uniform hemisphere sampling.


Posted

in

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *