Really, this equation looks nastier than it really is. The important part that I want to you try is to generate $(\phi, \theta)$ corresponding to a uniformly sampled direction w. The correct answer is:

Then the direction vector is: $(\sin \, \theta \cos \, \phi, \sin \, \theta \sin \, \phi, \cos \, \theta)$.

The equation shown above is the result of working a bit harder to avoid evaluating $\sin \, \theta$ or $\cos \, \theta$ in the algorithm. It comes from applying the half-angle identity and the double angle identity:

$$
sin \left( \frac{\theta}{2} \right) = \sqrt{\frac{1-cos \, \theta}{2}} \\
sin(2\theta) = 2 sin \, \theta \, cos \, \theta
$$

Plugging $\theta = cos^{-1} \, \xi_1$ into the above equation yields:

I'm kind of confused by this -- why are there three terms on the right hand side of this equation?

kayvonf

The RHS is a 3D vector. The slide is illustrating that random points in the 2D unit box can be mapped to random directions in the hemisphere.

kayvonf

Question: What if instead of sampling the hemisphere uniformly with respect to solid angle, we wanted to select random directions with a probability density proportional to $\cos \theta$? ($p(\omega) = c \, \cos \, \theta$). Note how this distribution biases samples towards the pole of the hemisphere. What is the Monte Carlo estimator for computing irradiance at a point P when samples are drawn from this distribution?

ak-47

The PDF is $p(angle=\theta) = cos(\theta)$. The CDF is the integral: sin(theta). So we can generate a random (a) in [0,1], and plug it into theta=sin-inverse(a) to get a direction.

Using the shortcut: $a=sin (\theta), cos(\theta)=(1-a^2)^{0.5}$

Has the Monte Carlo estimator changed?
It seems like $(2pi/n)* \sum_{i=1}^n cos(\theta_i) L_i$ is just as accurate as it was on the last slide.

kayvonf

No the estimator has not changed. The last slide described the estimator (which drew random direction samples to compute the estimate). This slide asked you to try and derive a way to compute a random direction vectors from two numbers uniformly sampled from the [0-1] domain.

Really, this equation looks nastier than it really is.

The important part that I want to you try is togenerate $(\phi, \theta)$ corresponding to a uniformly sampled direction w. The correct answer is:$$ \theta = cos^{-1} \, \xi_1 \\ \phi = 2\pi\xi_2 $$

Then the direction vector is: $(\sin \, \theta \cos \, \phi, \sin \, \theta \sin \, \phi, \cos \, \theta)$.

The equation shown above is the result of working a bit harder to avoid evaluating $\sin \, \theta$ or $\cos \, \theta$ in the algorithm. It comes from applying the half-angle identity and the double angle identity:$$ sin \left( \frac{\theta}{2} \right) = \sqrt{\frac{1-cos \, \theta}{2}} \\ sin(2\theta) = 2 sin \, \theta \, cos \, \theta $$

Plugging $\theta = cos^{-1} \, \xi_1$ into the above equation yields:

$$ sin \, \theta = sin \left( 2 \left( \frac{\theta}{2} \right) \right) = \\ 2 \, sin \, \frac{\theta}{2} \cos \frac{\theta}{2} = 2 \sqrt{\frac{1-cos \, \theta}{2}}\sqrt{\frac{1+cos \, \theta}{2}} = \\ 2 \sqrt{\frac{1-\xi_1}{2}}\sqrt{\frac{1+\xi_1}{2}} = \sqrt{{1-\xi_1^2}} $$

I'm kind of confused by this -- why are there three terms on the right hand side of this equation?

The RHS is a 3D vector. The slide is illustrating that random points in the 2D unit box can be mapped to random directions in the hemisphere.

Question:What if instead of sampling the hemisphereuniformly with respect to solid angle, we wanted to select random directions with a probability density proportional to $\cos \theta$? ($p(\omega) = c \, \cos \, \theta$). Note how this distribution biases samples towards the pole of the hemisphere. What is theMonte Carlo estimatorfor computing irradiance at a point P when samples are drawn from this distribution?The PDF is $p(angle=\theta) = cos(\theta)$. The CDF is the integral: sin(theta). So we can generate a random (a) in [0,1], and plug it into theta=sin-inverse(a) to get a direction.

Using the shortcut: $a=sin (\theta), cos(\theta)=(1-a^2)^{0.5}$

$(x,y,z)=(cos(\phi)sin(\theta), sin(\phi)sin(\theta), cos(\theta))$

Using our a that we generated:

$(x,y,z)=(a\ cos( \phi ), a\ sin(\phi), \sqrt{1-a^2})$

Now we just generate a "b" variable in [0,1] and set $\phi=2\pi*b$

$(x,y,z)=(a\ cos(2\pi b), a\ sin(2\pi *b), \sqrt{1-a^2})$

Has the Monte Carlo estimator changed? It seems like $(2pi/n)* \sum_{i=1}^n cos(\theta_i) L_i$ is just as accurate as it was on the last slide.

No the estimator has not changed. The last slide described the estimator (which drew random direction samples to compute the estimate). This slide asked you to try and derive a way to compute a random direction vectors from two numbers uniformly sampled from the [0-1] domain.