-
Notifications
You must be signed in to change notification settings - Fork 904
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
Book 1.10.6: Dark edge around hittables with Metal material #1285
Comments
Tempted to close this as "by design". From the book, with my emphasis added:
I agree that this is not an ideal solution, but I inclined to think that formally covering a possible fix for this isn't worth it. |
Hmmm, perhaps we should just put more guardrails around the fuzz factor. Current code:
Suggested update:
|
Nope, the above won't work, since the "fuzz sphere" will more easily intersect with the surface for grazing rays. This is the purpose of the |
The problem is that although only returning when not pointing into the sphere works, some energy carried by the rays is lost when rays are absorbed, resulting in a darker colour. So I choose to make the absorbed rays point out. The code first uses a dot product, and returns the scattered ray if the product is greater than 0. If not, return the tangent.
|
Hi, I'm following the first book's guide and noticed some parts around the fuzzy metal hittable sphere are darker than the center. I suspected it's because when the reflected vector is closer to the surface, where dot(hit.normal, reflected) is closer to 0, a random unit vector multiplied by a big fuzz will make the final scattered ray point inside the sphere. I added a dot check, multiplied the fuzz vector by the dot product, and solved the problem.


Before:
After:
The text was updated successfully, but these errors were encountered: