简体   繁体   中英

USDZ files cannot be opened in QuickLook app

I am trying to add some AR 3D models on my website with the CartMagician plugin for WooCommerce . For iPhones I have created a USDZ file. When i start the AR from Safari i get the error Zero KB . The path to the file is correct. The USDZ file has less than 20mb. I have also tested the USDZ file with Model Viewer AR plugin an there was the same problem so, probably, there is a problem with the model not with the platform. I was unable to find anything about the error Zero Kb anywhere.

I have uploaded the model here, USDZ and BLEND files. I have also uploaded a video with the error message .

I have created the USDZ file in 3 different ways. With a Blender export addon, with Pixar's USD Tools and with CartMagician converter. The models i try to use now was made with CartMagician conveter.

Can you, please, provided some tips about the file preparation process for conversion to USDZ and about how it should be used? also any information about the error Zerok Kb .

Thank you!

Your USDZ model has more than 400K polygons and has several 4K textures. It's the main problem of your QuickLook app, because CPU/GPU processing is TOO HIGH. Even macOS Quick Look opens such a file with a considerable time lag.

Apple recommends – A total number of polygons in your AR scene must be not greater than 100K and size of any texture must be not greater than 2K.

Also, check whether your code is like mine:

import ARKit
import QuickLook

extension ViewController: QLPreviewControllerDelegate,
                          QLPreviewControllerDataSource {
    
    func numberOfPreviewItems(in controller: QLPreviewController) -> Int {
        return 1
    }
    
    func previewController(_ controller: QLPreviewController, 
                    previewItemAt index: Int) -> QLPreviewItem {
        
        guard let path  = Bundle.main.path(forResource: "BannerESX5000",
                                                ofType: "usdz")
        else { fatalError("Couldn't find a model") }
        
        let url = URL(fileURLWithPath: path)           
        return url as QLPreviewItem
    }
}

class ViewController: UIViewController {
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        let previewController = QLPreviewController()
        previewController.delegate = self
        previewController.dataSource = self            
        self.present(previewController, animated: true, completion: nil)
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM