-
Notifications
You must be signed in to change notification settings - Fork 885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect linear interpolation in Chapter 4.2 #1652
Comments
@KDJDEV what makes you think that? All that |
Basically normalizing the vector makes it so the range of the y component is smaller than (-1, 1). |
@KDJDEV Oh, I see what you are saying now... we are not using the entire range between the two colors. The short answer is—it's not a big deal. The longer answer is—consider these points:
I hope this clarifies things. |
TBH I don't see it the way you do (as being confusing), but nevertheless, thank you for your input. Maybe some day when we get through the issues that have been collecting dust for some time, we can revisit this. For now, I will close this issue. |
I'll add some commentary about LERP and extrapolation since this is our introduction of the function. |
Chapter 4.2 describes linear interpolation as some function that outputs a color when given a value
a
that ranges from 0 to 1. However, the ray_color function does not makea
range from 0 to 1.Because the code runs
unit_vector
onr.direction()
, the y value no longer ranges from 1 to -1, and thereforea
does not range from 0 to 1. If you just don't makeunit_direction
into a unit vector then it works as expected.This is what I think the code should be:
The current code still does an interpolation between a sort of white and a sort of blue, but it does not perform a linear interpolation between
color(1.0, 1.0, 1.0)
andcolor(0.5, 0.7, 1.0)
.The text was updated successfully, but these errors were encountered: