diff --git a/CHANGELOG.md b/CHANGELOG.md index 1413b2b6..c3fb301b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Change Log -- Ray Tracing in One Weekend # v3.2.0 (in progress) ### Common + - Removed: now that the code handles ray-surface intersection from either side, we no longer need + the `flip_face` class, so we've deleted it from the text and from the code (#482, #270) + +### _The Next Week_ + - Removed: Deleted the section covering the old `flip_face` class, renumbered images as this + eliminated the rendering with missing Cornell box faces (#482) - Change: Renamed and explicitly numbered book images and figures (#495) - New: Added alternative constructors that take color arguments in addition to the constructors that take `shared_ptr` arguments, simplifying calling code. This applies to the diff --git a/books/RayTracingTheNextWeek.html b/books/RayTracingTheNextWeek.html index 8d5a407e..695c5406 100644 --- a/books/RayTracingTheNextWeek.html +++ b/books/RayTracingTheNextWeek.html @@ -2185,82 +2185,9 @@
We get: - ![Image 18: Initial empty Cornell box](../images/img-2.18-cornell-initial.jpg class=pixel) - -
- - -Flipped Objects ----------------- -
-This is very noisy because the light is small. But we have a problem: some of the walls are facing -the wrong way. We haven't specified that a diffuse material should behave differently on different -faces of the object, but what if the Cornell box had a different pattern on the inside and outside -walls? The rectangle objects are described such that their front faces are always in the directions -$(1,0,0)$, $(0,1,0)$, or $(0,0,1)$. We need a way to switch the faces of an object. Let’s make a -hittable that does nothing but hold another hittable, and flips the face: - - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ - class flip_face : public hittable { - public: - flip_face(shared_ptr p) : ptr(p) {} - - virtual bool hit(const ray& r, double t_min, double t_max, hit_record& rec) const { - if (!ptr->hit(r, t_min, t_max, rec)) - return false; - - rec.front_face = !rec.front_face; - return true; - } - - virtual bool bounding_box(double t0, double t1, aabb& output_box) const { - return ptr->bounding_box(t0, t1, output_box); - } - - public: - shared_ptr ptr; - }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - [Listing [flip-face]: [hittable.h] Flip-Face function] -
- -
-This makes Cornell: - - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ - hittable_list cornell_box() { - hittable_list objects; - - auto red = make_shared(color(.65, .05, .05)); - auto white = make_shared(color(.73, .73, .73)); - auto green = make_shared(color(.12, .45, .15)); - auto light = make_shared(color(15, 15, 15)); - - - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight - objects.add(make_shared(make_shared(0, 555, 0, 555, 555, green))); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ - objects.add(make_shared(0, 555, 0, 555, 0, red)); - objects.add(make_shared(213, 343, 227, 332, 554, light)); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight - objects.add(make_shared(make_shared(0, 555, 0, 555, 555, white))); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ - objects.add(make_shared(0, 555, 0, 555, 0, white)); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight - objects.add(make_shared(make_shared(0, 555, 0, 555, 555, white))); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ - - return objects; - } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - [Listing [cornell-box-flipped]: [main.cc] Empty Cornell box with flipped rectangles] -
- -
-And voila: - - ![Image 19: Empty Cornell box with fixed walls](../images/img-2.19-cornell-empty.jpg class=pixel) + ![Image 18: Empty Cornell box](../images/img-2.18-cornell-empty.jpg class=pixel) +This image is very noisy because the light is small.
@@ -2295,16 +2222,13 @@ box_max = p1; sides.add(make_shared(p0.x(), p1.x(), p0.y(), p1.y(), p1.z(), ptr)); - sides.add(make_shared( - make_shared(p0.x(), p1.x(), p0.y(), p1.y(), p0.z(), ptr))); + sides.add(make_shared(p0.x(), p1.x(), p0.y(), p1.y(), p0.z(), ptr)); sides.add(make_shared(p0.x(), p1.x(), p0.z(), p1.z(), p1.y(), ptr)); - sides.add(make_shared( - make_shared(p0.x(), p1.x(), p0.z(), p1.z(), p0.y(), ptr))); + sides.add(make_shared(p0.x(), p1.x(), p0.z(), p1.z(), p0.y(), ptr)); sides.add(make_shared(p0.y(), p1.y(), p0.z(), p1.z(), p1.x(), ptr)); - sides.add(make_shared( - make_shared(p0.y(), p1.y(), p0.z(), p1.z(), p0.x(), ptr))); + sides.add(make_shared(p0.y(), p1.y(), p0.z(), p1.z(), p0.x(), ptr)); } bool box::hit(const ray& r, double t0, double t1, hit_record& rec) const { @@ -2327,7 +2251,7 @@
This gives: - ![Image 20: Cornell box with two blocks](../images/img-2.20-cornell-blocks.jpg class=pixel) + ![Image 19: Cornell box with two blocks](../images/img-2.19-cornell-blocks.jpg class=pixel)
@@ -2555,7 +2479,7 @@
Which yields: - ![Image 21: Standard Cornell box scene](../images/img-2.21-cornell-standard.jpg class=pixel) + ![Image 20: Standard Cornell box scene](../images/img-2.20-cornell-standard.jpg class=pixel)
@@ -2728,12 +2652,12 @@ auto green = make_shared(color(.12, .45, .15)); auto light = make_shared(color(7, 7, 7)); - objects.add(make_shared(make_shared(0, 555, 0, 555, 555, green))); + objects.add(make_shared(0, 555, 0, 555, 555, green)); objects.add(make_shared(0, 555, 0, 555, 0, red)); objects.add(make_shared(113, 443, 127, 432, 554, light)); - objects.add(make_shared(make_shared(0, 555, 0, 555, 555, white))); + objects.add(make_shared(0, 555, 0, 555, 555, white)); objects.add(make_shared(0, 555, 0, 555, 0, white)); - objects.add(make_shared(make_shared(0, 555, 0, 555, 555, white))); + objects.add(make_shared(0, 555, 0, 555, 555, white)); shared_ptr box1 = make_shared(point3(0,0,0), point3(165,330,165), white); box1 = make_shared(box1, 15); @@ -2755,7 +2679,7 @@
We get: - ![Image 22: Cornell box with blocks of smoke](../images/img-2.22-cornell-smoke.jpg class=pixel) + ![Image 21: Cornell box with blocks of smoke](../images/img-2.21-cornell-smoke.jpg class=pixel)
@@ -2839,7 +2763,7 @@
Running it with 10,000 rays per pixel yields: - ![Image 23: Final scene](../images/img-2.23-book2-final.jpg) + ![Image 22: Final scene](../images/img-2.22-book2-final.jpg)
diff --git a/books/RayTracingTheRestOfYourLife.html b/books/RayTracingTheRestOfYourLife.html index 9c081e08..855c0e67 100644 --- a/books/RayTracingTheRestOfYourLife.html +++ b/books/RayTracingTheRestOfYourLife.html @@ -763,12 +763,12 @@ auto green = make_shared(color(.12, .45, .15)); auto light = make_shared(color(15, 15, 15)); - world.add(make_shared(make_shared(0, 555, 0, 555, 555, green))); + world.add(make_shared(0, 555, 0, 555, 555, green)); world.add(make_shared(0, 555, 0, 555, 0, red)); - world.add(make_shared(make_shared(213, 343, 227, 332, 554, light))); - world.add(make_shared(make_shared(0, 555, 0, 555, 555, white))); + world.add(make_shared(213, 343, 227, 332, 554, light)); + world.add(make_shared(0, 555, 0, 555, 555, white)); world.add(make_shared(0, 555, 0, 555, 0, white)); - world.add(make_shared(make_shared(0, 555, 0, 555, 555, white))); + world.add(make_shared(0, 555, 0, 555, 555, white)); shared_ptr box1 = make_shared(point3(0,0,0), point3(165,330,165), white); box1 = make_shared(box1, 15); @@ -2115,12 +2115,12 @@ auto green = make_shared(color(.12, .45, .15)); auto light = make_shared(color(15, 15, 15)); - world.add(make_shared(make_shared(0, 555, 0, 555, 555, green))); + world.add(make_shared(0, 555, 0, 555, 555, green)); world.add(make_shared(0, 555, 0, 555, 0, red)); - world.add(make_shared(make_shared(213, 343, 227, 332, 554, light))); - world.add(make_shared(make_shared(0, 555, 0, 555, 555, white))); + world.add(make_shared(213, 343, 227, 332, 554, light)); + world.add(make_shared(0, 555, 0, 555, 555, white)); world.add(make_shared(0, 555, 0, 555, 0, white)); - world.add(make_shared(make_shared(0, 555, 0, 555, 555, white))); + world.add(make_shared(0, 555, 0, 555, 555, white)); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C++ highlight diff --git a/images/img-2.19-cornell-empty.jpg b/images/img-2.18-cornell-empty.jpg similarity index 100% rename from images/img-2.19-cornell-empty.jpg rename to images/img-2.18-cornell-empty.jpg diff --git a/images/img-2.18-cornell-initial.jpg b/images/img-2.18-cornell-initial.jpg deleted file mode 100644 index d103272e..00000000 Binary files a/images/img-2.18-cornell-initial.jpg and /dev/null differ diff --git a/images/img-2.20-cornell-blocks.jpg b/images/img-2.19-cornell-blocks.jpg similarity index 100% rename from images/img-2.20-cornell-blocks.jpg rename to images/img-2.19-cornell-blocks.jpg diff --git a/images/img-2.21-cornell-standard.jpg b/images/img-2.20-cornell-standard.jpg similarity index 100% rename from images/img-2.21-cornell-standard.jpg rename to images/img-2.20-cornell-standard.jpg diff --git a/images/img-2.22-cornell-smoke.jpg b/images/img-2.21-cornell-smoke.jpg similarity index 100% rename from images/img-2.22-cornell-smoke.jpg rename to images/img-2.21-cornell-smoke.jpg diff --git a/images/img-2.23-book2-final.jpg b/images/img-2.22-book2-final.jpg similarity index 100% rename from images/img-2.23-book2-final.jpg rename to images/img-2.22-book2-final.jpg