
Post by krotus on Mar 24, 2020 20:45:21 GMT
So I was stuck trying to render my sphere silhouette for a couple of days. Every ray produced a "hit".
Quoting from the book:
When I wrote the hit function, I wrote it so that if an object intersection's units from the ray's origin was greater than or equal to zero, then it was a hit, simply based upon the wording in the book. How I got the silhouette to render was changing the code from "greater than or equal to zero" to "greater than zero".
Now, sitting here writing this, seeing myself explain it, I guess that it makes sense. I'm just wondering if that's accurate  that zero units from a ray's origin is not a hit.


fremag
Junior Member
Posts: 73

Post by fremag on Mar 24, 2020 21:16:14 GMT
In my Hit function, I check if t >= 0, so t=0 is a hit. Imagine you have a sphere tangent to the camera, so there is one point where t=0. If you remove this point, there will be a "hole" in your sphere I think.



Post by krotus on Mar 25, 2020 1:52:57 GMT
In my Hit function, I check if t >= 0, so t=0 is a hit. Imagine you have a sphere tangent to the camera, so there is one point where t=0. If you remove this point, there will be a "hole" in your sphere I think. Did you test that by setting the ray's origin to (0, 0, 1)? With t > 0 in my hit function I do not get a hole in the sphere even at larger renders like 300 x 300. If I set the ray's origin to (0, 0, 1), every ray registers as a hit.

