raytracing.github.io
raytracing.github.io copied to clipboard
Book 1: Figure 10 image should be replaced.
hello, thank you for the great books! I've been following your books step by step, and if I'm not mistaken, I found a minor error in a drawing.
vec3 random_unit_vector() {
return unit_vector(random_in_unit_sphere());
}
I think the normalized random point inside a unit sphere should be drawn like below:
current image:
Picking points as you've shown would suffer from a number of problems. First, some points would reside inside the object, bouncing backwards. Second, a bounce in any direction would be equally likely, instead of with a “probability higher for ray scattering close to the normal”. The existing image is “offset along the surface normal”, as described.
Since all points along the chord from P to S are collapsed into a single unit vector, you can see how the chord that contains the normal vector is the longest (and therefore more likely), and the chord shrinks down to zero as points approach the line perpendicular to the normal. This gets us random rays with “probability higher for ray scattering close to the normal”.
Since all points along the chord from P to S are collapsed into a single unit vector, you can see how the chord that contains the normal vector is the longest (and therefore more likely)
Oh now I understood the drawing, thank you so much.
I've understood the concept all along, but the description of an image saying,
Generating a random unit vector
confused me a little.
Now I know red arrow in the drawing doesn't represent a unit vector itself but the length of it represents probability.
I think the existing section has ample opportunity for confusion. One simple improvement would be to move the figure before the sentence starting with “Picking random points on the unit sphere …”.
The sentence “This is achieved by picking random points on the surface of the unit sphere, offset along the surface normal” has problems because of the comma, which makes it seem that the points are offset, when in fact it's the sphere that's offset.
Good time to think if the figure can be further improved as well.
I am confused by the illustration in this section and the construction of the ray:
point3 target = rec.p + rec.normal + random_unit_vector();
return 0.5 * ray_color(ray(rec.p, target - rec.p), world, depth-1);
The first point of confusion is the redundant calculations: target
has rec.p
added and then subtracted in ray(rec.p, target - rec.p)
, yet there are no other usages of target
in the scope it's defined in.
Secondly, the ray
is constructed with a direction vector that is not a unit vector. As the illustration on this page shows, the magnitude of the direction vector will be between 2 and 0. Won't this affect ray traversal?
PR #1178 addressed the last bits of this mutated issue.