Replies: 4 comments
-
I've had a similar problem with the "edges" of the sphere becoming black. The image seems to be correct enough without it so I just commented it out for now. I'd love to hear from you if you figure it out |
Beta Was this translation helpful? Give feedback.
-
I really don’t see any difference between my code and the official code. Are you also using rust @L3tum ? |
Beta Was this translation helpful? Give feedback.
-
I'm actually using C#, but the NaN handling seems to be different in that From my limited amount of googling it appears that there may be two bugs at hand. One is that the reflected ray will intersect the sphere immediately again and the other is that the refracted ray may not intersect through the sphere. Here is a stackoverflow question about it as well. |
Beta Was this translation helpful? Give feedback.
-
I've implemented the code only for the Total Internal Reflection from the answer of that stackoverflow question and it seems to work exactly the same. However while playing around I've noticed that using if (etaiOverEtat * sinTheta > 1f)
{
var reflected = Util.ReflectVec(unitDirection, record.Normal);
scattered = new Ray(ray.Origin, reflected, ray.Time);
return true;
} Here is an album showing the 3 implementations. I don't think it's applicable to your issue though since your entire sphere is black. I had the problem that some rectangles in the cornell box were black and found out that my normal method wasn't correct (I was using (0,0,0) as the ray direction when calculating the front face). Maybe that's your problem as well. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I’m following this book in rust to discover raytracing and I have a strange bug / artifact.
I was wondering if someone already had this kind of artifact and knew where it could come from.
Basically everything works great until the 10.3 part where I get a totally black sphere:

I tried to do only reflection or only refraction and both seems to works:

It breaks when I use this condition to choose which one to do:
if etai_over_etat * sin_theta > 1.
.Also I tried to do the next part with the schlick approximation to see if it would fix the problem, it does not. Here is the result if it can help:
My code is here is someone want to check something:
https://github.com/irevoire/raytracing_in_one_weekend
Beta Was this translation helpful? Give feedback.
All reactions