Skip to content

Commit f566c2b

Browse files
committed
Subchapters: integrating review feedback
1 parent 5a775d3 commit f566c2b

File tree

3 files changed

+64
-58
lines changed

3 files changed

+64
-58
lines changed

books/RayTracingInOneWeekend.html

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
corner to be yellow.
117117

118118

119-
Creating An Image File
119+
Creating an Image File
120120
-----------------------
121121
<div class='together'>
122122
Because the file is written to the program output, you'll need to redirect it to an image file.
@@ -221,8 +221,8 @@
221221
have a good point, but we’re going to always take the “less code” route when not obviously wrong.
222222

223223

224-
Main Class
225-
-----------
224+
Variables and Methods
225+
----------------------
226226
<div class='together'>
227227
Here’s the top part of my `vec3` class:
228228

@@ -423,7 +423,7 @@
423423
</div>
424424

425425

426-
Sending Rays Into The Scene
426+
Sending Rays Into the Scene
427427
----------------------------
428428
Now we are ready to turn the corner and make a ray tracer. At the core, the ray tracer sends rays
429429
through pixels and computes the color seen in the direction of those rays. The involved steps are
@@ -640,7 +640,7 @@
640640
====================================================================================================
641641

642642

643-
Shading With Surface Normals
643+
Shading with Surface Normals
644644
-----------------------------
645645
First, let’s get ourselves a surface normal so we can shade. This is a vector that is perpendicular
646646
to the surface at the point of intersection. There are two design decisions to make for normals.
@@ -709,8 +709,8 @@
709709
</div>
710710

711711

712-
Improving the Ray-Sphere Intersection Code
713-
-------------------------------------------
712+
Simplifying the Ray-Sphere Intersection Code
713+
---------------------------------------------
714714
Let’s revisit the ray-sphere equation:
715715

716716
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
@@ -988,8 +988,8 @@
988988
</div>
989989

990990

991-
Lists of Hittable Objects
992-
--------------------------
991+
A List of Hittable Objects
992+
---------------------------
993993
<div class='together'>
994994
We add a list of objects:
995995

@@ -1282,7 +1282,7 @@
12821282
</div>
12831283

12841284

1285-
Generating Pixels With Multiple Samples
1285+
Generating Pixels with Multiple Samples
12861286
----------------------------------------
12871287
<div class='together'>
12881288
For a given pixel we have several samples within that pixel and send rays through each of the
@@ -1512,7 +1512,7 @@
15121512
</div>
15131513

15141514

1515-
Limiting The Number of Child Rays
1515+
Limiting the Number of Child Rays
15161516
----------------------------------
15171517
<div class='together'>
15181518
There's one potential problem lurking here. Notice that the `ray_color` function is recursive. When
@@ -1582,7 +1582,7 @@
15821582
</div>
15831583

15841584

1585-
Using Gamma Correction For Accurate Color Intensity
1585+
Using Gamma Correction for Accurate Color Intensity
15861586
----------------------------------------------------
15871587
<div class='together'>
15881588
Note the shadowing under the sphere. This picture is very dark, but our spheres only absorb half the
@@ -1722,8 +1722,8 @@
17221722
</div>
17231723

17241724

1725-
Even Truer Lambertian Reflection
1726-
---------------------------------
1725+
An Alternative Diffuse Formulation
1726+
-----------------------------------
17271727
<div class='together'>
17281728
The initial hack presented in this book lasted a long time before it was proven to be an incorrect
17291729
approximation of ideal Lambertian diffuse. A big reason that the error persisted for so long is
@@ -1806,7 +1806,7 @@
18061806
Metal
18071807
====================================================================================================
18081808

1809-
An Abstract Class For Materials
1809+
An Abstract Class for Materials
18101810
--------------------------------
18111811
If we want different objects to have different materials, we have a design decision. We could have a
18121812
universal material with lots of parameters and different material types just zero out some of those
@@ -1832,7 +1832,7 @@
18321832
</div>
18331833

18341834

1835-
A Data Structure To Describe Ray-Object Intersections
1835+
A Data Structure to Describe Ray-Object Intersections
18361836
------------------------------------------------------
18371837
<div class='together'>
18381838
The `hit_record` is to avoid a bunch of arguments so we can stuff whatever info we want in there.
@@ -1946,7 +1946,7 @@
19461946
</div>
19471947

19481948

1949-
Modeling Light Scatter And Reflectance
1949+
Modeling Light Scatter and Reflectance
19501950
---------------------------------------
19511951
<div class='together'>
19521952
For the Lambertian (diffuse) case we already have, it can either scatter always and attenuate by its
@@ -2056,7 +2056,7 @@
20562056
</div>
20572057

20582058

2059-
A Scene With Metal Spheres
2059+
A Scene with Metal Spheres
20602060
---------------------------
20612061
<div class='together'>
20622062
Now let’s add some metal spheres to our scene:
@@ -2603,7 +2603,7 @@
26032603
</div>
26042604

26052605

2606-
Positioning and Orienting The Camera
2606+
Positioning and Orienting the Camera
26072607
-------------------------------------
26082608
To get an arbitrary viewpoint, let’s first name the points we care about. We’ll call the position
26092609
where we place the camera _lookfrom_, and the point we look at _lookat_. (Later, if you want, you

books/RayTracingTheNextWeek.html

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
interval that we want.
5050

5151

52-
Updating The Ray Class to Track Time
53-
-------------------------------------
52+
Introduction of SpaceTime Ray Tracing
53+
--------------------------------------
5454
We can get a random estimate by sending each ray at some random time when the shutter is open. As
5555
long as the objects are where they should be at that time, we can get the right average answer with
5656
a ray that is at exactly a single time. This is fundamentally why random ray tracing tends to be
@@ -96,7 +96,7 @@
9696
</div>
9797

9898

99-
Updating the Camera To Simulate Motion Blur
99+
Updating the Camera to Simulate Motion Blur
100100
--------------------------------------------
101101
Now we need to modify the camera to generate rays at a random time between `time1` and `time2`.
102102
Should the camera keep track of `time1` and `time2` or should that be up to the user of camera when
@@ -166,8 +166,8 @@
166166
[Listing [time-camera]: <kbd>[camera.h]</kbd> Camera with time information]
167167

168168

169-
Moving Objects
170-
---------------
169+
Adding Moving Spheres
170+
----------------------
171171
We also need a moving object. I’ll create a sphere class that has its center move linearly from
172172
`center0` at `time0` to `center1` at `time1`. Outside that time interval it continues on, so those
173173
times need not match up with the camera aperture open and close.
@@ -251,7 +251,7 @@
251251
</div>
252252

253253

254-
Tracking The Time Of Ray Intersection
254+
Tracking the Time of Ray Intersection
255255
--------------------------------------
256256
<div class='together'>
257257
Be sure that in the materials you have the scattered rays be at the time of the incident ray.
@@ -377,8 +377,8 @@
377377
models.
378378

379379

380-
Creating Bounding Volumes
381-
--------------------------
380+
The Key Idea
381+
-------------
382382
<div class='together'>
383383
The key idea of a bounding volume over a set of primitives is to find a volume that fully encloses
384384
(bounds) all the objects. For example, suppose you computed a bounding sphere of 10 objects. Any ray
@@ -493,11 +493,10 @@
493493
</div>
494494

495495

496-
Determining If a Ray Intersects an AABB
497-
----------------------------------------
496+
Ray Intersection with an AABB
497+
------------------------------
498498
<div class='together'>
499-
What the question “do the t intervals in the slabs overlap?” would look like in code is something
500-
like this:
499+
The following pseudocode determines whether the $t$ intervals in the slab overlap:
501500

502501
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
503502
compute (tx0, tx1)
@@ -637,7 +636,7 @@
637636
</div>
638637

639638

640-
Constructing Bounding Boxes For Hittables
639+
Constructing Bounding Boxes for Hittables
641640
------------------------------------------
642641
<div class='together'>
643642
We now need to add a function to compute the bounding boxes of all the hittables. Then we will make
@@ -1055,7 +1054,7 @@
10551054
</div>
10561055

10571056

1058-
Rendering A Scene With A Checkered Texture
1057+
Rendering a Scene with a Checkered Texture
10591058
-------------------------------------------
10601059
<div class='together'>
10611060
If we add a new scene:
@@ -1283,7 +1282,7 @@
12831282
</div>
12841283

12851284

1286-
Smoothing Out The Result
1285+
Smoothing out the Result
12871286
-------------------------
12881287
<div class='together'>
12891288
To make it smooth, we can linearly interpolate:
@@ -1342,8 +1341,8 @@
13421341
</div>
13431342

13441343

1345-
Another Approach to Smoothing
1346-
------------------------------
1344+
Improvement with Hermitian Smoothing
1345+
-------------------------------------
13471346
<div class='together'>
13481347
Smoothing yields an improved result, but there are obvious grid features in there. Some of it is
13491348
Mach bands, a known perceptual artifact of linear interpolation of color. A standard trick is to use
@@ -1419,7 +1418,7 @@
14191418
</div>
14201419

14211420

1422-
Using Random Vectors On The Lattice Points
1421+
Using Random Vectors on the Lattice Points
14231422
-------------------------------------------
14241423
<div class='together'>
14251424
This is still a bit blocky looking, probably because the min and max of the pattern always lands
@@ -1669,7 +1668,7 @@
16691668
record.
16701669

16711670

1672-
Texture Coordinates For Spheres
1671+
Texture Coordinates for Spheres
16731672
--------------------------------
16741673
For spheres, this is usually based on some form of longitude and latitude, _i.e._, spherical
16751674
coordinates. So if we have a $(\theta,\phi)$ in spherical coordinates, we just need to scale
@@ -1787,20 +1786,22 @@
17871786
[Listing [incl-stb-img]: Including the STB image package]
17881787
</div>
17891788

1789+
1790+
Using an Image Texture
1791+
-----------------------
17901792
<div class='together'>
1793+
I just grabbed a random earth map from the web -- any standard projection will do for our purposes.
17911794

17921795
<div class="render">
17931796

17941797
![earthmap.jpg](../images/earthmap.jpg)
17951798

17961799
</div>
17971800

1801+
</div>
17981802

1799-
Using An Image Texture
1800-
-----------------------
1801-
To read an image from a file earthmap.jpg (I just grabbed a random earth map from the web -- any
1802-
standard projection will do for our purposes), and then assign it to a diffuse material, the code
1803-
is:
1803+
<div class='together'>
1804+
Here's the code to read an image from a file and then assign it to a diffuse material:
18041805

18051806
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++
18061807
hittable_list earth() {
@@ -1836,6 +1837,11 @@
18361837

18371838
Rectangles and Lights
18381839
====================================================================================================
1840+
Lighting is a key component of raytracing. Early simple raytracers used abstract light sources, like
1841+
points in space, or directions. Modern approaches have more physically-based lights, which have
1842+
position and size. To create such light sources, we need to be able to take any regular object and
1843+
turn it into something that emits light into our scene.
1844+
18391845

18401846
Emissive Materials
18411847
-------------------
@@ -1888,7 +1894,7 @@
18881894
</div>
18891895

18901896

1891-
Adding Background Color to The Ray Color Function
1897+
Adding Background Color to the Ray Color Function
18921898
--------------------------------------------------
18931899
<div class='together'>
18941900
Next, we want a pure black background so the only light in the scene is coming from the emitters. To
@@ -2013,7 +2019,7 @@
20132019
</div>
20142020

20152021

2016-
Turning Objects Into Lights
2022+
Turning Objects into Lights
20172023
----------------------------
20182024
<div class='together'>
20192025
If we set up a rectangle as a light:
@@ -2154,7 +2160,7 @@
21542160
</div>
21552161

21562162

2157-
Creating An Empty “Cornell Box”
2163+
Creating an Empty “Cornell Box”
21582164
--------------------------------
21592165
<div class='together'>
21602166
The “Cornell Box” was introduced in 1984 to model the interaction of light between diffuse surfaces.
@@ -2740,7 +2746,7 @@
27402746
handles arbitrary shapes, but we'll leave that as an exercise for the reader.
27412747

27422748

2743-
Rendering a Cornell Box With Smoke and Fog Boxes
2749+
Rendering a Cornell Box with Smoke and Fog Boxes
27442750
-------------------------------------------------
27452751
<div class='together'>
27462752
If we replace the two blocks with smoke and fog (dark and light particles) and make the light bigger

0 commit comments

Comments
 (0)