Skip to content

hit_sphere return value #954

Answered by hollasch
crypto-dot asked this question in Q&A
Discussion options

You must be logged in to vote

At that point in the code, the scene and camera are pretty much hard-coded. All objects are in front of the camera. Given this, the nearest root is guaranteed to be the one with the smallest ray t value. Also, note the comment:

If you change your sphere center to $z = +1$ you will get exactly the same picture because you see the things behind you. This is not a feature! We’ll fix those issues next.

Also note the latter comment:

We'll just assume the closest hit point (smallest $t$).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by crypto-dot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants