Mirror of the code from http://www.edesign.nl/examples/sunlightmap/