The set of lights contributing to each object is computed and the optimized shader for that set is used.