Optimized HDRi creation algorithm