Cleaned up some funky math.

Also started shader code for sampling atmospherically scattered light.