Skip to content

Commit d653f2a

Browse files
rupsishollasch
authored andcommitted
Resolving #1500
1 parent 4a9da46 commit d653f2a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

books/RayTracingTheRestOfYourLife.html

+9-3
Original file line numberDiff line numberDiff line change
@@ -1401,10 +1401,16 @@
14011401
doesn't matter which coordinate system you choose to use. Although, however you choose to do it,
14021402
remember that a PDF must integrate to one over the whole surface and that the PDF represents the
14031403
_relative probability_ of that direction being sampled. Recall that we have a `vec3` function to
1404-
generate uniform random samples on the unit sphere (`random_unit_vector()`). What is the PDF of
1405-
these uniform samples? As a uniform density on the unit sphere, it is $1/\mathit{area}$ of the
1404+
generate uniform random samples on the unit sphere $d$ (`random_unit_vector()`). What is the PDF
1405+
of these uniform samples? As a uniform density on the unit sphere, it is $1/\mathit{area}$ of the
14061406
sphere, which is $1/(4\pi)$. If the integrand is $\cos^2(\theta)$, and $\theta$ is the angle with
1407-
the $z$ axis:
1407+
the $z$ axis, we can use scalar projection to re-write $\cos^2(\theta)$ in terms of the $d_z$:
1408+
1409+
$$ d_z = \lVert d \rVert \cos \theta = 1 \cdot \cos \theta $$
1410+
1411+
We can then substitute $1 \cdot \cos \theta$ with $d_z$ giving us:
1412+
1413+
$$ f(\theta, \phi) = \cos^2 (\theta) = {d_z}^2 $$
14081414

14091415
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
14101416
#include "rtweekend.h"

0 commit comments

Comments
 (0)