Optimizing light calculations