Hey, I’m glad you found a solution! However, I feel like there may be a deeper issue here. The approach described in the book (transforming the ray by the inverse of the sphere’s transformation matrix, and then running the ray/sphere intersection as described) really should have “just worked”. The fact that you got t
values that were half what was expected suggests that at some point maybe you were using the original ray origin/direction somewhere, or perhaps using the wrong transformation matrix?
Ultimately, as long as you’re getting the right answer now, it’s all good. I just worry that you may be doing more work than is necessary to obtain those t
values, which may come back to bite you later in the book when render times grow longer and longer and every computation counts.
I’d be happy to take a look at your code if its available somewhere, if that would be helpful.