The Ray Tracer Challenger: unnecessary normalization (page 73)

In the last hint (#4) of Chapter 5, the pseudocode applies a normalization to the origin ray:

  • r ← ray(ray_origin, normalize(position - ray_origin))

normalizing in this case unnecessary, since with or without, the intersections detected are going to be the same.

My supposition is that this it was an accidental addition, or that it’s a common practice, so it’s been added even if it’s not necessary.

I think it should be either removed, or, if the case is the second, some explanation should be given, in particular, because at this stage of the book, it’s not entirely clear when normalization should be performed (there is only a generic explanation at page 30), so I find it (at least, personally) confusing.

1 Like

You’re right that I should explained that better. As it is: yes, you’ll detect an intersection whether the ray is normalized or not, but the distance to that intersection will differ depending on whether or not the ray is normalized. For this example, the distance doesn’t matter, just the fact of an intersection is sufficient.

So, yeah, maybe I could have left that off here. But the thinking was that for the next chapter, it would carry over. (See step #3 of “Putting It Together” in Chapter 6.)