Skip to content
This repository was archived by the owner on Oct 10, 2019. It is now read-only.

Commit 07682b3

Browse files
committed
Host site from root of master (was from docs/)
- move assets directory from docs/assets/ to assets/ - move docs/ to book/ - move home index.html file to root of workspace - update asset links from book source
1 parent 12211ca commit 07682b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+41
-41
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/ch01.md.html renamed to book/ch01.md.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
);
254254
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
255255

256-
![Image 1-1](assets/img1-01.jpg)
256+
![Image 1-1](../assets/img1-01.jpg)
257257

258258

259259

docs/ch02.md.html renamed to book/ch02.md.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
divided a set of objects into two groups, red and blue, and used rectangular bounding volumes, we’d
4040
have:
4141

42-
![Figure 2-1](assets/fig2-01.jpg)
42+
![Figure 2-1](../assets/fig2-01.jpg)
4343

4444
Note that the blue and red bounding volumes are contained in the purple one, but they might
4545
overlap, and they are not ordered -- they are just both inside. So the tree shown on the right has
@@ -70,13 +70,13 @@
7070
the points between two endpoints, _e.g._, $x$ such that $3 < x < 5$, or more succinctly $x$ in
7171
$(3,5)$. In 2D, two intervals overlapping makes a 2D AABB (a rectangle):
7272

73-
![Figure 2-2](assets/fig2-02.jpg)
73+
![Figure 2-2](../assets/fig2-02.jpg)
7474

7575
For a ray to hit one interval we first need to figure out whether the ray hits the boundaries. For
7676
example, again in 2D, this is the ray parameters $t_0$ and $t_1$. (If the ray is parallel to the
7777
plane those will be undefined.)
7878

79-
![Figure 2-3](assets/fig2-03.jpg)
79+
![Figure 2-3](../assets/fig2-03.jpg)
8080

8181
In 3D, those boundaries are planes. The equations for the planes are $x = x_0$, and $x = x_1$. Where
8282
does the ray hit that plane? Recall that the ray can be thought of as just a function that given a
@@ -100,7 +100,7 @@
100100
The key observation to turn that 1D math into a hit test is that for a hit, the $t$-intervals need
101101
to overlap. For example, in 2D the green and blue overlapping only happens if there is a hit:
102102

103-
![Figure 2-4](assets/fig2-04.jpg)
103+
![Figure 2-4](../assets/fig2-04.jpg)
104104

105105
What “do the t intervals in the slabs overlap?” would like in code is something like:
106106

docs/ch03.md.html renamed to book/ch03.md.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989

9090
We get:
9191

92-
![Image 3-1](assets/img3-01.jpg)
92+
![Image 3-1](../assets/img3-01.jpg)
9393

9494
If we add a new scene:
9595

@@ -121,7 +121,7 @@
121121

122122
We get:
123123

124-
![Image 3-2](assets/img3-02.jpg)
124+
![Image 3-2](../assets/img3-02.jpg)
125125

126126

127127

docs/ch04.md.html renamed to book/ch04.md.html

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
To get cool looking solid textures most people use some form of Perlin noise. These are named after
1212
their inventor Ken Perlin. Perlin texture doesn’t return white noise like this:
1313

14-
![Image 4-1](assets/img4-01.jpg)
14+
![Image 4-1](../assets/img4-01.jpg)
1515

1616
Instead it returns something similar to blurred white noise:
1717

18-
![Image 4-2](assets/img4-02.jpg)
18+
![Image 4-2](../assets/img4-02.jpg)
1919

2020
A key part of Perlin noise is that it is repeatable: it takes a 3D point as input and always returns
2121
the same randomish number. Nearby points return similar numbers. Another important part of Perlin
@@ -25,7 +25,7 @@
2525
We could just tile all of space with a 3D array of random numbers and use them in blocks. You get
2626
something blocky where the repeating is clear:
2727

28-
![Image 4-3](assets/img4-03.jpg)
28+
![Image 4-3](../assets/img4-03.jpg)
2929

3030
Let’s just use some sort of hashing to scramble this, instead of tiling. This has a bit of support
3131
code to make it all happen:
@@ -118,7 +118,7 @@
118118

119119
Add the hashing does scramble as hoped:
120120

121-
![Image 4-4](assets/img4-04.jpg)
121+
![Image 4-4](../assets/img4-04.jpg)
122122

123123
To make it smooth, we can linearly interpolate:
124124

@@ -163,7 +163,7 @@
163163

164164
And we get:
165165

166-
![Image 4-5](assets/img4-05.jpg)
166+
![Image 4-5](../assets/img4-05.jpg)
167167

168168
Better, but there are obvious grid features in there. Some of it is Mach bands, a known perceptual
169169
artifact of linear interpolation of color. A standard trick is to use a hermite cubic to round off
@@ -189,7 +189,7 @@
189189

190190
This gives a smoother looking image:
191191

192-
![Image 4-6](assets/img4-06.jpg)
192+
![Image 4-6](../assets/img4-06.jpg)
193193

194194
It is also a bit low frequency. We can scale the input point to make it vary more quickly:
195195

@@ -208,7 +208,7 @@
208208

209209
which gives:
210210

211-
![Image 4-7](assets/img4-07.jpg)
211+
![Image 4-7](../assets/img4-07.jpg)
212212

213213
This is still a bit grid blocky looking, probably because the min and max of the pattern always
214214
lands exactly on the integer x/y/z. Ken Perlin’s very clever trick was to instead put random unit
@@ -286,7 +286,7 @@
286286

287287
This finally gives something more reasonable looking:
288288

289-
![Image 4-8](assets/img4-08.jpg)
289+
![Image 4-8](../assets/img4-08.jpg)
290290

291291
Very often, a composite noise that has multiple summed frequencies is used. This is usually called
292292
turbulence and is a sum of repeated calls to noise:
@@ -309,7 +309,7 @@
309309

310310
Used directly, turbulence gives a sort of camouflage netting appearance:
311311

312-
![Image 4-9](assets/img4-09.jpg)
312+
![Image 4-9](../assets/img4-09.jpg)
313313

314314
However, usually turbulence is used indirectly. For example, the “hello world” of procedural solid
315315
textures is a simple marble-like texture. The basic idea is to make color proportional to something
@@ -334,7 +334,7 @@
334334

335335
Which yields:
336336

337-
![Image 4-10](assets/img4-10.jpg)
337+
![Image 4-10](../assets/img4-10.jpg)
338338

339339

340340

docs/ch05.md.html renamed to book/ch05.md.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
To test this, assign it to a sphere, and then temporarily cripple the color() function in main to
122122
just return attenuation. You should get something like:
123123

124-
![Image 5-1](assets/img5-01.jpg)
124+
![Image 5-1](../assets/img5-01.jpg)
125125

126126

127127

docs/ch06.md.html renamed to book/ch06.md.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
First, here is a rectangle in an xy plane. Such a plane is defined by its z value. For example, $z =
6666
k$. An axis-aligned rectangle is defined by lines $x=x_0$ , $x=x_1$ , $y=y_0$ , $y=y_1$.
6767

68-
![Figure 6-1](assets/fig6-01.jpg)
68+
![Figure 6-1](../assets/fig6-01.jpg)
6969

7070
To determine whether a ray hits such a rectangle, we first determine where the ray hits the plane.
7171
Recall that a ray $p(t) = a + t \cdot b$ has its z component defined by $z(t) = a_z + t \cdot b_z$.
@@ -137,13 +137,13 @@
137137

138138
We get:
139139

140-
![Image 6-1](assets/img6-01.jpg)
140+
![Image 6-1](../assets/img6-01.jpg)
141141

142142
Note that the light is brighter than $(1,1,1)$. This allows it to be bright enough to light things.
143143

144144
Fool around with making some spheres lights too.
145145

146-
![Image 6-2](assets/img6-02.jpg)
146+
![Image 6-2](../assets/img6-02.jpg)
147147

148148
Now let’s add the other two axes and the famous Cornell Box.
149149

@@ -253,7 +253,7 @@
253253

254254
We get:
255255

256-
![Image 6-3](assets/img6-03.jpg)
256+
![Image 6-3](../assets/img6-03.jpg)
257257

258258
This is very noisy because the light is small. But why are the other walls missing? They are facing
259259
the wrong way. We need outward facing normals. Let’s make a hitable that does nothing but hold
@@ -307,7 +307,7 @@
307307

308308
And voila:
309309

310-
![Image 6-4](assets/img6-04.jpg)
310+
![Image 6-4](../assets/img6-04.jpg)
311311

312312

313313

docs/ch07.md.html renamed to book/ch07.md.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
This gives:
5757

58-
![Image 7-1](assets/img7-01.jpg)
58+
![Image 7-1](../assets/img7-01.jpg)
5959

6060
Now that we have boxes, we need to rotate them a bit to have them match the _real_ Cornell box. In
6161
ray tracing, this is usually done with an _instance_. An instance is a geometric primitive that has
@@ -65,7 +65,7 @@
6565
or (as we almost always do in ray tracing) leave the box where it is, but in its hit routine
6666
subtract 2 off the x-component of the ray origin.
6767

68-
![Figure 7-1](assets/fig7-01.jpg)
68+
![Figure 7-1](../assets/fig7-01.jpg)
6969

7070
Whether you think of this as a move or a change of coordinates is up to you. The code for this, to
7171
move any underlying hitable is a _translate_ instance.
@@ -107,7 +107,7 @@
107107
First, let’s rotate by theta about the z-axis. That will be changing only x and y, and in ways that
108108
don’t depend on z.
109109

110-
![Figure 7-2](assets/fig7-02.jpg)
110+
![Figure 7-2](../assets/fig7-02.jpg)
111111

112112
This involves some basic trigonometry that uses formulas that I will not cover here. That gives you
113113
the correct impression it’s a little involved, but it is straightforward, and you can find it in any
@@ -228,7 +228,7 @@
228228

229229
Which yields:
230230

231-
![Image 7-2](assets/img7-02.jpg)
231+
![Image 7-2](../assets/img7-02.jpg)
232232

233233

234234

docs/ch08.md.html renamed to book/ch08.md.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
far the ray has to travel through the volume also determines how likely it is for the ray to make it
2222
through.
2323

24-
![Figure 8-1](assets/fig8-01.jpg)
24+
![Figure 8-1](../assets/fig8-01.jpg)
2525

2626
As the ray passes through the volume, it may scatter at any point. The denser the volume, the more
2727
likely that is. The probability that the ray scatters in any small distance $\delta L$ is:
@@ -92,7 +92,7 @@
9292
return false;
9393
if (rec1.t < 0)
9494
rec1.t = 0;
95-
float distance_inside_boundary =
95+
float distance_inside_boundary =
9696
(rec2.t - rec1.t)*r.direction().length();
9797
float hit_distance = -(1/density)*log(drand48());
9898
if (hit_distance < distance_inside_boundary) {
@@ -152,7 +152,7 @@
152152

153153
We get:
154154

155-
![Image 8-1](assets/img8-01.jpg)
155+
![Image 8-1](../assets/img8-01.jpg)
156156

157157

158158

docs/ch09.md.html renamed to book/ch09.md.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171

7272
Running it with 10,000 rays per pixel yields:
7373

74-
![Image 9-1](assets/img9-01.jpg)
74+
![Image 9-1](../assets/img9-01.jpg)
7575

7676
Now go off and make a really cool image of your own! See http://in1weekend.com/ for pointers to
7777
further reading and features, and feel free to email questions, comments, and cool images to me at

docs/index.html renamed to index.html

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
**Rough Content**
99

10-
- [Chapter 0](ch00.md.html)
11-
- [Chapter 1](ch01.md.html)
12-
- [Chapter 2](ch02.md.html)
13-
- [Chapter 3](ch03.md.html)
14-
- [Chapter 4](ch04.md.html)
15-
- [Chapter 5](ch05.md.html)
16-
- [Chapter 6](ch06.md.html)
17-
- [Chapter 7](ch07.md.html)
18-
- [Chapter 8](ch08.md.html)
19-
- [Chapter 9](ch09.md.html)
10+
- [Chapter 0](book/ch00.md.html)
11+
- [Chapter 1](book/ch01.md.html)
12+
- [Chapter 2](book/ch02.md.html)
13+
- [Chapter 3](book/ch03.md.html)
14+
- [Chapter 4](book/ch04.md.html)
15+
- [Chapter 5](book/ch05.md.html)
16+
- [Chapter 6](book/ch06.md.html)
17+
- [Chapter 7](book/ch07.md.html)
18+
- [Chapter 8](book/ch08.md.html)
19+
- [Chapter 9](book/ch09.md.html)
2020

2121

2222

0 commit comments

Comments
 (0)