Skip to content

Commit 375888f

Browse files
authored
Correct range of scatter angle theta in sec 3.3.5 (#1620)
Resolves #1331
1 parent d32eea1 commit 375888f

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Change Log / Ray Tracing in One Weekend
2424
### The Rest of Your Life
2525
- Fix -- Fix typo of "arbitrary" (#1589)
2626
- New -- Added a bit more explanation of Buffon's needle problem (#1529)
27+
- Fix -- Corrected scatter angle theta range in section 3.5.3 (The Scattering PDF) (#1331)
2728
- Fix -- Clarify the distinction between average and expected value (#1535)
2829

2930

books/RayTracingTheRestOfYourLife.html

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,23 +1572,29 @@
15721572
For a Lambertian surface we already implicitly implemented this formula for the special case where
15731573
$pScatter(\, \ldots \,)$ is a cosine density. The $\operatorname{pScatter}(\, \ldots \,)$ of a
15741574
Lambertian surface is proportional to $\cos(\theta_o)$, where $\theta_o$ is the angle relative to
1575-
the surface normal. Let's solve for $C$ once more:
1575+
the surface normal ($\theta_o \in [0,\pi]$). An angle of $0$ indicates an outgoing direction in the
1576+
same direction as the surface normal, and an angle of $\pi$ indicates an outgoing direction exactly
1577+
opposite the normal vector.
1578+
1579+
Let's solve for $C$ once more:
15761580

15771581
$$ \operatorname{pScatter}(\mathbf{x}, \omega_i, \omega_o, \lambda) = C \cdot \cos(\theta_o) $$
15781582

15791583
All two dimensional PDFs need to integrate to one over the whole surface (remember that
1580-
$\operatorname{pScatter}$ is a PDF). We set $\operatorname{pScatter}(\theta_o < 0) = 0$ so that we
1581-
don't scatter below the horizon.
1584+
$\operatorname{pScatter}$ is a PDF). We set
1585+
$\operatorname{pScatter}(\frac{\pi}{2} < \theta_o \le \pi) = 0$ so that we don't scatter below the
1586+
horizon. Given this, we only need to integrate $\theta \in [0, \frac{\pi}{2}]$.
15821587

1583-
$$ 1 = \int_{0}^{2 \pi} \int_{0}^{\pi / 2} C \cdot \cos(\theta) dA $$
1588+
$$ 1 = \int_{\phi = 0}^{2 \pi} \int_{\theta = 0}^\frac{\pi}{2} C \cdot \cos(\theta) dA $$
15841589

15851590
To integrate over the hemisphere, remember that in spherical coordinates:
15861591

15871592
$$ dA = \sin(\theta) d\theta d\phi $$
15881593

15891594
So:
15901595

1591-
$$ 1 = C \cdot \int_{0}^{2 \pi} \int_{0}^{\pi / 2} \cos(\theta) \sin(\theta) d\theta d\phi $$
1596+
$$ 1 = C \cdot \int_0^{2 \pi} \int_0^\frac{\pi}{2}
1597+
\cos(\theta) \sin(\theta) d\theta d\phi $$
15921598
$$ 1 = C \cdot 2 \pi \frac{1}{2} $$
15931599
$$ 1 = C \cdot \pi $$
15941600
$$ C = \frac{1}{\pi} $$

books/acknowledgments.md.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
- [Shota Kawajiri](https://github.com/estshorter)
6969
- Tatsuya Ogawa
7070
- Thiago Ize
71+
- [Thien Tran](https://github.com/gau-nernst)
7172
- Vahan Sosoyan
7273
- [WANG Lei](https://github.com/wlbksy)
7374
- [Yann Herklotz](https://github.com/ymherklotz)

0 commit comments

Comments
 (0)