Ground sphere from "Ray Tracing in a weekend" warps into the top of the image, resulting image looks like two spheres ~ one at top and one at bottom #1706
Replies: 3 comments
-
Compare against branch |
Beta Was this translation helpful? Give feedback.
-
Thank you for the response @hollasch. I didn't compare the branches unfortunately, but after spending a lot of time. I realized what was causing the bug.
So, finally after spending 2 days on this bug ~ i finally understood the reason why it was not working! But I learned a lot 😄 |
Beta Was this translation helpful? Give feedback.
-
Glad you figured it out! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
You can reproduce this by exactly implementing code up till Section 5. Once you implement till the mentioned section, change the position of sphere from ( 0, 0, 0 ) to ( 0, -100.5, -1 ) and radius from 0.5 to 100. Let's refer to this big sphere as "ground"
My questions:
The logic seems sound, we have positioned the ground such that the rays from the lower half of the viewport hit the top area of the sphere. Then how do the top half of the viewport also get the hit on the ground
Is it related to viewport size / image dimensions?
Is it a bug? or is it an "after-product" of the so called "pin-hole" camera that we implement. If yes, I don't understand exactly why that happens
Surprisingly, once we implement Section 6.7 ~ the issue disappears. I don't understand how and why, because up till Section 5, we are just checking for hits and even if we just check for hits, we shouldn't get any "warping" or duplication of spheres
The setup would look something like this, all the files are same as the book's
I will provide you main.cpp, just in case if I am doing anything wrong. Rest three files, one can take from the website
main.cpp
This is when i change the Y axis and position it even lower in Y axis
This is when i change the Z axis and position is further away from camera
Can someone shine some light on this? I am having a lot of trouble understanding this
Beta Was this translation helpful? Give feedback.
All reactions