Fix ray-sphere intersection

Fix a bug where it would hang if the image size was less than n-threads tiles
Make coordinates z-up