optimized buildLightData function