|
Post by Txus on Mar 14, 2019 9:08:09 GMT
This is a really strange bug that I haven't been able to solve. All tests pass, and I'm just done with shadows, cameras and patterns. (Haven't started the reflection/refraction part yet). However, I find that whenver I add a floor or a wall (be it a Plane or a squashed Sphere), I get some kind of copy of it hovering at the opposite axis and eclipsing all objects no matter where they are.
The best way to show you what I mean is attaching the images. This is the original image, 4 spheres:
Then I add a floor and this weird eclipsing ceiling appears:
Then I add a wall on the left and you can see how far on the right there's a weird dark banner:
Then if I add a right wall quite in front, you can see how the correctly rendered portion of the image shrinks even more:
Any hints on what could be causing this? As I mentioned, all tests are passing and I can't figure out where the problem is.
|
|
|
Post by Jamis on Mar 14, 2019 14:57:40 GMT
That really is odd! Is there anywhere I could look at your code? At the very least, the ray-plane intersection code, but it'd be nice to see the whole stack--ray/world, ray/shape, ray/plane.
Edit: I just saw where you said it happens with any shape, even squashed spheres. Can you try this experiment? Using a sphere, at what point does it start to produce odd effects? How squashed/stretched does it need to be? Because it seems to be fine with the spheres you started with; there must be something else going on, perhaps when a shape extends beyond some point in the scene?
|
|
|
Post by ascotti on Mar 14, 2019 16:52:01 GMT
The first image suggests you may be hitting the plane with a backwards ray (i.e. the hit has a negative t) but this is something tests should catch, so it's quite puzzling indeed.
|
|
|
Post by Jamis on Mar 14, 2019 16:56:34 GMT
Actually, I'll bet you're right, ascotti. The "reflections" are all occurring where a negative-t intersection would exist.
|
|
|
Post by Txus on Mar 16, 2019 5:34:33 GMT
OMG!! Turns out the color_at function was taking just the *first* of all the intersections from the world, instead of computing the hit correctly. It's fixed now! Thank you
|
|