|
Post by twistdroach on Aug 13, 2020 4:22:10 GMT
It seems like my lighting is off. However - all tests pass. The code is on github here: github.com/twistdroach/raytracer-cOne thing that is interesting is that in my MATERIAL_lighting function - where we subtract light position from the point where the ray intersected the sphere to find the light vector, if i reverse the subtraction I get something that is different and very close to correct, but not correct....and - this makes all the material tests fail, so I'm sure that's not it. Anyway - not really expecting anyone to sift through a bunch of C, but really just wondering if anyone has any troubleshooting tips or intuitively recognized a bug that would create the above image. Thanks for any help anyone is able to provide - I will update if I figure it out....
|
|
|
Post by twistdroach on Aug 15, 2020 4:05:19 GMT
Aha! Figured it out! I was casting my rays with the origin set from the wrong variable (instead of ray_origin of all things!!)...now - I can put the subtraction in the correct order and the image looks great. Was infuriating to track down - as all my tests were passing, so I knew it had to be in the tiny amount of code that was the chap. 6 putting it all together... As an aside - I love the format of this book. There should be an entire series of books for test driven projects (if there is someone let me know!). Test driven game boy emulator, etc etc...
|
|
|
Post by chrisd on Aug 20, 2020 4:30:20 GMT
I have been thinking it would be neat to create a book like that (well, not game boy emulator), but there's just not enough time, sadly.
|
|
|
Post by Jamis on Aug 20, 2020 15:31:19 GMT
I'm glad you figured it out, twistdroach! Yeah, these bugs can be infuriating, and time consuming, but it sure does feel great when you finally figure it out. I'd love to write more books like this. If you have any specific topics you'd like to see covered, let me know; no guarantees, of course, but I'm open to suggestions!
|
|