|
Post by alches on Dec 22, 2020 19:42:04 GMT
Hey everyone,
I have my ray tracer set up to the point where it can correctly parse .obj files with vertex normals, but something's not right in my rendering of them. I can see smoothing working well along the surface and then on portions of it I see patchy triangles that seem to think the light source is someplace else.. I've checked my implementation of Moller-trumbore and it's correct as far as I can see. But the problem must be somewhere in the normal interpolation, right? All relevant tests from the book are passing, so I'm pretty stuck here.
Here's an example of a icosphere render-gone-wrong:
Thanks in advance for any help!
|
|
|
Post by alches on Dec 24, 2020 1:23:33 GMT
I'm a broken man.
I can say now after two days of pure terror (just kidding) it's finally fixed. I found out in my swap() function for my intersection object I forgot to include swap()'s for u and v. So whenever I sorted a list of intersections by their t values, they would be correctly sorted, except they would carry with them the u's and v's of whatever object they were last swapped with. So this had to do with my C++...
Note: it's always good to have unit tests for C++ copy & swap functions
|
|