Skip to content

Book 3 code doesn't work if the glass ball is replaced with the original diffuse box #760

@hollasch

Description

@hollasch

The source code diverged from the listings in book 3, where listing 38 and image 9 had the original short box in the Cornell scene:

shared_ptr<hittable> box2 = make_shared<box>(point3(0,0,0), point3(165,165,165), white);
box2 = make_shared<rotate_y>(box2, -18);
box2 = make_shared<translate>(box2, vec3(130,0,65);
world.add(box2);

In the source code, this was changed without explanation to

auto glass = make_shared<dielectric>(1.5);
world.add(make_shared<sphere>(point3(190,90,190), 90 , glass));

If you substitute the original short box in the scene, you get a black image with only the square light source showing. Something's broken or hasn't been fully implemented in the source.

Note that pending PR #757 changes the book to reflect the current source, so shows a valid image with the glass sphere. The problem still remains, however.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions