Skip to content

Commit 282b46f

Browse files
committed
Book 3 review, Chapters 4-6, responding to feedback
1 parent a48e5d4 commit 282b46f

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

books/RayTracingTheRestOfYourLife.html

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,10 +1309,10 @@
13091309
least for ray tracing--is producing a random direction. In the first two books we generated a random
13101310
direction by creating a random vector and rejecting it if it fell outside of the unit sphere. We
13111311
repeated this process until we found a random vector that fell inside the unit sphere. Normalizing
1312-
this vector produced points that lay exactly on the unit sphere and thereby producing a random
1313-
direction. This process of generating samples and rejecting them if they are not inside of a desired
1314-
space is called _the rejection method_ and is found all over the literature. The method covered last
1315-
chapter is referred to as _the inversion method_ because we invert a PDF.
1312+
this vector produced points that lay exactly on the unit sphere and thereby represent a random
1313+
direction. This process of generating samples and rejecting them if they are not inside a desired
1314+
space is called _the rejection method_, and is found all over the literature. The method covered
1315+
last chapter is referred to as _the inversion method_ because we invert a PDF.
13161316

13171317
Every direction in 3D space has an associated point on the unit sphere and can be generated by
13181318
solving for the vector that travels from the origin to that associated point. You can think of
@@ -1437,9 +1437,8 @@
14371437
wavelength of the light: $\mathit{pScatter}(\omega_i, \omega_o, \lambda)$. A good example
14381438
of this is a prism refracting white light into a rainbow. Lastly, the scattering PDF can also depend
14391439
on the scattering position: $\mathit{pScatter}(\mathbf{x}, \omega_i, \omega_o, \lambda)$. The
1440-
$\mathbf{x}$ is just a vector representing the scattering position: $\mathbf{x} = (x, y, z)$. The
1441-
albedo of an object can also depend on these quantities:
1442-
$A(\mathbf{x}, \omega_i, \omega_o, \lambda)$.
1440+
$\mathbf{x}$ is just math notation for the scattering position: $\mathbf{x} = (x, y, z)$. The albedo
1441+
of an object can also depend on these quantities: $A(\mathbf{x}, \omega_i, \omega_o, \lambda)$.
14431442

14441443
<div class='together'>
14451444
The color of a surface is found by integrating these terms over the unit hemisphere by the incident
@@ -1543,7 +1542,7 @@
15431542
Playing with Importance Sampling
15441543
====================================================================================================
15451544
<div class='together'>
1546-
Our goal over the next four chapters is to instrument our program to send a bunch of extra rays
1545+
Our goal over the next several chapters is to instrument our program to send a bunch of extra rays
15471546
toward light sources so that our picture is less noisy. Let’s assume we can send a bunch of rays
15481547
toward the light source using a PDF $\mathit{pLight}(\omega_o)$. Let’s also assume we have a PDF
15491548
related to $\mathit{pScatter}$, and let’s call that $\mathit{pSurface}(\omega_o)$. A great thing
@@ -1599,8 +1598,8 @@
15991598
</div>
16001599

16011600
First, let’s instrument the code so that it explicitly samples some PDF and then normalizes for
1602-
that. Remember Monte Carlo basics: $\int f(x) \approx \sum f(r)/p(r)$. For the Lambertian material, let’s
1603-
sample like we do now: $p(\omega_o) = \cos(\theta_o) / \pi$.
1601+
that. Remember Monte Carlo basics: $\int f(x) \approx \sum f(r)/p(r)$. For the Lambertian material,
1602+
let’s sample like we do now: $p(\omega_o) = \cos(\theta_o) / \pi$.
16041603

16051604
<div class='together'>
16061605
We modify the base-class `material` to enable this importance sampling:
@@ -1702,7 +1701,7 @@
17021701
The ray_color function, modified for importance sampling]
17031702
</div>
17041703

1705-
You should get exactly the same picture. Which, _should make sense_, as the scattered part of
1704+
You should get exactly the same picture. Which _should make sense_, as the scattered part of
17061705
`ray_color` is getting multiplied by `scattering_pdf / pdf`, and as `pdf` is equal to
17071706
`scattering_pdf` is just the same as multiplying by one.
17081707

@@ -1788,13 +1787,13 @@
17881787
attempt to repeat the uniform hemispherical scattering from the first book. There's nothing wrong
17891788
with this technique, but we are no longer treating our objects as Lambertian. Lambertian is a
17901789
specific type of diffuse material that requires a $\cos(\theta_o)$ scattering distribution.
1791-
Uniform hemispherical scattering is another diffuse material, albeit a different one. If we keep the
1792-
material the same but change the PDF, as we did in last section, we will still converge on the same
1793-
answer, but our convergence may take more or less samples. However, if we change the material, we
1794-
will have fundamentally changed the render and the algorithm will converge on a different answer. So
1795-
when we replace Lambertian diffuse with uniform hemispherical diffuse we should expect that the
1796-
outcome of our render to be _materially_ different. We're going to adjust our scattering direction
1797-
and scattering PDF:
1790+
Uniform hemispherical scattering is a different diffuse material. If we keep the material the same
1791+
but change the PDF, as we did in last section, we will still converge on the same answer, but our
1792+
convergence may take more or less samples. However, if we change the material, we will have
1793+
fundamentally changed the render and the algorithm will converge on a different answer. So when we
1794+
replace Lambertian diffuse with uniform hemispherical diffuse we should expect the outcome of our
1795+
render to be _materially_ different. We're going to adjust our scattering direction and scattering
1796+
PDF:
17981797

17991798
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
18001799
class lambertian : public material {

0 commit comments

Comments
 (0)