Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Confusion inverse vector figure 13 in Ray Tracing In One Weekend #1718

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /