make light calculation multithreaded