|
Post by adamkunz on Oct 2, 2021 5:58:30 GMT
My glass cubes are displaying acne. Here's the same scene but with spheres: I've spent a couple hours checking for floating point errors and making sure my code lines up to what's in the book, but I can't seem to figure it out. Any thoughts on what's causing the acne? I figure it's got to be something with the refraction calculations or possibly the schlick() function.
|
|
|
Post by Jamis on Oct 4, 2021 15:37:45 GMT
adamkunz, I think I know what the problem is! It's something endemic to ray-tracers and objects with flat surfaces. With your cube set perfectly adjacent to the floor, the bottom of your cube and the floor are actually occupying the same infinitesimal sliver of space. Intersections that hit that surface will sometimes evaluate to the cube, and sometimes to the floor, because there's no space between them. The "acne" is where your renderer intersected the floor (or its reflection) instead of the cube. The solution, generally, is to add some tiny amount of space between your cube and the floor. Try raising the cube off the floor a ridiculously tiny amount, like 0.0001, and see if that helps.
|
|
|
Post by adamkunz on Oct 5, 2021 0:05:02 GMT
That did the trick! Thanks!
|
|