title: ray tracing shadow bug
body: <p><img src="https://i.stack.imgur.com/HQAFB.jpg" alt="Comparison"></p>
  
  <p><a href="http://pastebin.com/vkTJt0sT" rel="nofollow noreferrer">http://pastebin.com/vkTJt0sT</a></p>
  
  <p>I am trying to render an image similiar to the left one and having problem with shadows+reflections.</p>
  
  <p>Right now, only the shadow code is open for showing the problem.</p>
  
  <p>As you can see, the red ball should be shadowed near the green one, but the pixels all get messed up for some weird reason. When I close the shadow part of the code, it renders the red ball normally without shadows.</p>
  
  <p>I think the root of this problem is also affecting reflections. hope you guys can give me some tips; I’m losing it.</p>