Optimizing light calculation