Closed fernLightning closed 8 years ago
Oh, interesting! I think this may be an issue with the NaN-prevention, which can change the length of the direction. I hadn't considered this.
I just pushed your proposed fix, let me know whether that removes the problem.
Thanks!
yes, that fixes the problem.
fyi: removing the NaN-prevention code had no notable effect, and also toying with sphereSegmentIntersect() code (e.g. subtracting a small offset from the times) wasn't reliable or added other artifacts into the scene.
The NaN prevention is an odd one; I'm not entirely sure why it fixes problems, but I was in contact with a few people on Intel cards that experienced problems with black horizontal or vertical lines that would appear after a while and permanently corrupt the image.
From that description it did seem likely that a division by a zero directional component was causing issues somewhere, even though all relevant code guards against that. Debugging funky shader compilers remotely was difficult, so I just added code permutations until they reported it as fixed :)
In any case, thanks for reporting back.
I found that 'Cardoid' scene would leak many rays into the inner box, and that in other scenes I was seeing occasional rays pass through lenses (via the circular part) unaffected.
I was able to resolve the issue by adding a normalise() into the unPackRay() func, i.e
osx 10.11.1 - Intel HD Graphics 5000 - safari 9.01 (possibly a a symptom of the graphics card as an AMD based mac had no issue).