-
Couldn't load subscription status.
- Fork 950
Open
@thibaultdupont-cpe
Description
Hi,
I think Figure 13 is confusing when compared to Code Listing 45.
and
inline vec3 random_on_hemisphere(const vec3& normal) { vec3 on_unit_sphere = random_unit_vector(); if (dot(on_unit_sphere, normal) > 0.0) // In the same hemisphere as the normal return on_unit_sphere; else return -on_unit_sphere; }
The drawing suggests a symmetry over the plane, whereas the code returns the inverse vector (which is also what the text explains). While both approaches preserve the probabilistic distribution, a new drawing could help avoid this confusion.
It could also be possible to apply the symmetry using:
return on_unit_sphere-2*dot(on_unit_sphere, normal)*normal;
Metadata
Metadata
Assignees
Labels
No labels