File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1401
1401
doesn't matter which coordinate system you choose to use. Although, however you choose to do it,
1402
1402
remember that a PDF must integrate to one over the whole surface and that the PDF represents the
1403
1403
_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
1406
1406
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 $$
1408
1414
1409
1415
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
1410
1416
#include "rtweekend.h"
You can’t perform that action at this time.
0 commit comments