Skip to content

Commit 428abf9

Browse files
authored
Merge pull request #916 from RayTracing/fix-textbf
Use mathbf{} instead of textbf{}
2 parents 2da9199 + 3188747 commit 428abf9

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Change Log -- Ray Tracing in One Weekend
2828
- Fix: rect hit returning NaNs and infinities. Superseded with new `quad` primitive (#681)
2929
- Added: New 2D `quad` primitive of arbitrary orientation (#756)
3030
- Added: New `box()` utility function returns `hittable_list` of new `quad` primitives (#780)
31-
- Fix: Add `\mathit` to italic math variables to fix slight kerning issues (#839)
31+
- Fix: Add `\mathit` to italic math variables to fix slight kerning issues in equations (#839)
3232

3333
### In One Weekend
3434
- Added: More commentary about the choice between `double` and `float` (#752)

books/RayTracingTheRestOfYourLife.html

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,18 +1345,18 @@
13451345
PDF can also vary with _incident direction_: $\mathit{pScatter}(\omega_i, \omega_o)$. You can see
13461346
this varying with incident direction when you look at reflections off a road -- they become
13471347
mirror-like as your viewing angle (incident angle) approaches grazing. Lastly, the scattering PDF
1348-
can also depend on the scattering position: $\mathit{pScatter}(\textbf{x}, \omega_i, \omega_o)$. The
1349-
$\textbf{x}$ is just a vector representing the scattering position: $\textbf{x} = (x, y, z)$. The
1350-
Albedo of an object can also depend on these quantities: $A(\textbf{x}, \omega_i, \omega_o)$.
1348+
can also depend on the scattering position: $\mathit{pScatter}(\mathbf{x}, \omega_i, \omega_o)$. The
1349+
$\mathbf{x}$ is just a vector representing the scattering position: $\mathbf{x} = (x, y, z)$. The
1350+
Albedo of an object can also depend on these quantities: $A(\mathbf{x}, \omega_i, \omega_o)$.
13511351

13521352
<div class='together'>
13531353
The color of a surface is found by integrating these terms over the unit hemisphere by the incident
13541354
direction:
13551355

1356-
$$ \text{Color}_o(\textbf{x}, \omega_o) = \int_{\omega_i}
1357-
A(\textbf{x}, \omega_i, \omega_o) \cdot
1358-
\mathit{pScatter}(\textbf{x}, \omega_i, \omega_o) \cdot
1359-
\text{Color}_i(\textbf{x}, \omega_i) $$
1356+
$$ \text{Color}_o(\mathbf{x}, \omega_o) = \int_{\omega_i}
1357+
A(\mathbf{x}, \omega_i, \omega_o) \cdot
1358+
\mathit{pScatter}(\mathbf{x}, \omega_i, \omega_o) \cdot
1359+
\text{Color}_i(\mathbf{x}, \omega_i) $$
13601360

13611361
We've added a $\text{Color}_i$ term. The scattering PDF and the albedo at the surface of an object
13621362
are acting as filters to the light that is shining on that point. So we need to solve for the light
@@ -1373,13 +1373,13 @@
13731373
<div class='together'>
13741374
If we apply the Monte Carlo basic formula we get the following statistical estimate:
13751375

1376-
$$ \text{Color}_o = \frac{A(\textbf{x}, \omega_i, \omega_o) \cdot
1377-
\mathit{pScatter}(\textbf{x}, \omega_i, \omega_o) \cdot
1378-
\text{Color}_i(\textbf{x}, \omega_i)}
1379-
{p(\textbf{x}, \omega_o)} $$
1376+
$$ \text{Color}_o = \frac{A(\mathbf{x}, \omega_i, \omega_o) \cdot
1377+
\mathit{pScatter}(\mathbf{x}, \omega_i, \omega_o) \cdot
1378+
\text{Color}_i(\mathbf{x}, \omega_i)}
1379+
{p(\mathbf{x}, \omega_o)} $$
13801380

1381-
where $p(\textbf{x}, \omega_o)$ is the PDF of whatever outgoing direction we randomly generate.
1382-
We'll simplify to just $p(\omega_o)$ because we won't be varying the PDF by $\textbf{x}$.
1381+
where $p(\mathbf{x}, \omega_o)$ is the PDF of whatever outgoing direction we randomly generate.
1382+
We'll simplify to just $p(\omega_o)$ because we won't be varying the PDF by $\mathbf{x}$.
13831383
</div>
13841384

13851385
For a Lambertian surface we already implicitly implemented this formula for the special case where
@@ -1414,8 +1414,8 @@
14141414

14151415
The numerator and denominator cancel out, and we get:
14161416

1417-
$$ \text{Color}_o = A(\textbf{x}, \omega_i, \omega_o) \cdot
1418-
\text{Color}_i(\textbf{x}, \omega_i) $$
1417+
$$ \text{Color}_o = A(\mathbf{x}, \omega_i, \omega_o) \cdot
1418+
\text{Color}_i(\mathbf{x}, \omega_i) $$
14191419

14201420
This is exactly what we had in our original `ray_color()` function!
14211421

@@ -1427,8 +1427,8 @@
14271427
volumes. If you read the literature, you’ll see reflection defined by the
14281428
_Bidirectional Reflectance Distribution Function_ (BRDF). It relates pretty simply to our terms:
14291429

1430-
$$ BRDF(\omega_i, \omega_o) = \frac{A(\textbf{x}, \omega_i, \omega_o) \cdot
1431-
\mathit{pScatter}(\textbf{x}, \omega_i, \omega_o)}{\cos(\theta_o)} $$
1430+
$$ BRDF(\omega_i, \omega_o) = \frac{A(\mathbf{x}, \omega_i, \omega_o) \cdot
1431+
\mathit{pScatter}(\mathbf{x}, \omega_i, \omega_o)}{\cos(\theta_o)} $$
14321432

14331433
So for a Lambertian surface for example, $BRDF = A / \pi$. Translation between our terms and BRDF is
14341434
easy. For participating media (volumes), our albedo is usually called the _scattering albedo_, and
@@ -1459,11 +1459,11 @@
14591459
we can use any PDF: _all PDFs eventually converge to the correct answer_. So, the game is to figure
14601460
out how to make the PDF larger where the product
14611461

1462-
$$ \mathit{pScatter}(\textbf{x}, \omega_i, \omega_o) \cdot
1463-
\text{Color}_i(\textbf{x}, \omega_i) $$
1462+
$$ \mathit{pScatter}(\mathbf{x}, \omega_i, \omega_o) \cdot
1463+
\text{Color}_i(\mathbf{x}, \omega_i) $$
14641464

14651465
is largest. For diffuse surfaces, this is mainly a matter of guessing where
1466-
$\text{Color}_i(\textbf{x}, \omega_i)$ is largest. Which is equivalent to guessing where the most
1466+
$\text{Color}_i(\mathbf{x}, \omega_i)$ is largest. Which is equivalent to guessing where the most
14671467
light is coming from.
14681468

14691469
For a mirror, $\mathit{pScatter}()$ is huge only near one direction, so $\mathit{pScatter}()$

0 commit comments

Comments
 (0)