简体   繁体   English

USDZ 文件无法在 QuickLook 应用中打开

[英]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 .我正在尝试使用 WooCommerce 的CartMagician插件在我的网站上添加一些 AR WooCommerce模型。 For iPhones I have created a USDZ file.对于 iPhone,我创建了一个 USDZ 文件。 When i start the AR from Safari i get the error Zero KB .当我从 Safari 启动 AR 时,我收到错误Zero KB The path to the file is correct.文件的路径是正确的。 The USDZ file has less than 20mb. USDZ 文件小于 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.我还使用 Model 查看器 AR 插件测试了 USDZ 文件,并且出现了同样的问题,因此可能是 model 存在问题而不是平台。 I was unable to find anything about the error Zero Kb anywhere.我无法在任何地方找到有关错误Zero Kb的任何信息。

I have uploaded the model here, USDZ and BLEND files.我在这里上传了 model、USDZ 和 BLEND 文件。 I have also uploaded a video with the error message .我还上传了带有错误消息的视频。

I have created the USDZ file in 3 different ways.我以 3 种不同的方式创建了 USDZ 文件。 With a Blender export addon, with Pixar's USD Tools and with CartMagician converter.使用 Blender 导出插件,使用 Pixar 的 USD 工具和 CartMagician 转换器。 The models i try to use now was made with CartMagician conveter.我现在尝试使用的模型是用 CartMagician 转换器制作的。

Can you, please, provided some tips about the file preparation process for conversion to USDZ and about how it should be used?您能否提供一些关于转换为 USDZ 的文件准备过程以及如何使用它的提示? also any information about the error Zerok Kb .还有关于错误Zerok Kb的任何信息。

Thank you!谢谢!

Your USDZ model has more than 400K polygons and has several 4K textures.您的 USDZ model 拥有超过 400K 的多边形和多个 4K 纹理。 It's the main problem of your QuickLook app, because CPU/GPU processing is TOO HIGH.这是您的 QuickLook 应用程序的主要问题,因为 CPU/GPU 处理能力太高。 Even macOS Quick Look opens such a file with a considerable time lag.即使是 macOS 快速查看打开这样的文件也会有相当长的时间延迟。

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. Apple 建议– AR 场景中的多边形总数不得大于 100K,任何纹理的大小不得大于 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)
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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