r/GraphicsProgramming • u/Public-Slip8450 • Aug 07 '24
Raytracing in One Weekend SetFaceNormal Error
Currently working on Raytracing in one weekend and keep running into this issue where my SetFaceNormal() is causing that ring on the sphere. I’ve commented out where the function is called to show that it renders correctly. My set face normal math is 1:1 to the book yet I get the ring? Can anyone explain where I may have gone wrong?
2
Upvotes
1




2
u/Ok-Sherbert-6569 Aug 07 '24 edited Aug 07 '24
I’ve a feeling you’re intersecting the sphere at front and back side because you’re not culling the furthest intersection point with the ray. Let’s see your intersection function Edit : just checked your intersection function and I’ve no idea why you’re doing what you’re doing. You either intersect with the sphere or you don’t. This range checking in nonsense stuff. Take the smallest t and as long as it’s not negative then you have your valid intersection