xcode - USDZ 文件未在 iPhone 7 上加载

标签 xcode 3d augmented-reality arkit usdz

我们的 USDZ 文件无法在装有 iOS 12 的 iPhone 7 上加载。它在运行 iOS 12 Beta 的我的 iPhone X 和 iPad Pro 上运行良好。

我们已尝试使用终端命令创建它并收到以下警告,但我们认为这不是问题所在。

Warning: in CreateMaterialBindings at line 59 of /BuildRoot/Library/Caches/com.apple.xbs/Sources/3DAssetTools/3DAssetTools-14207.2/external/ModelKit/extern/usd/pxr/usd/usdObj/translator.cpp -- OBJ mtl usemtl name has invalid name '15___Default', using default usemtl name: 'defaultShadeGroup0' 

iPhone 7 的屏幕看起来是这样的:

enter image description here

您可以下载原始文件here .

最佳答案

You can't see your 3D model because you're using very bad naming convention for file model2_$$usd_converter$$_.usdc inside usdz container. In macOS and iOS you have to avoid using $ in file names, because dollar sign is a special character.

按照这两个步骤解压缩、重命名和重新压缩您的 usdz 文件。

第一步(解压mmtest.usdz文件)

To unzip a usdz file in macOS Mojave use the following method:

  • 在 Finder 中将 .usdz 文件的扩展名更改为 .zip
  • 使用 Archive_Utility.appRAR_Extractor.app 解压缩 .zip 文件。
  • 打开解压缩的目录并更改文件名。
  • 确保所有纹理都是 JPG 和/或 PNG 格式。
  • 确保您的 USDC 模型的 3D 法线没有反转。

enter image description here

enter image description here

enter image description here

第二步(重新创建usdz)

确保已安装 Xcode 10.2。

To convert a content of unzipped folder (binary usdc file and its textures) to usdz file format again, use the following command in Terminal.app:

cd ~/Desktop/mmtest/


xcrun usdz_converter Model.usdc Model.usdz 
-g SofaMesh
-color_map Diffuse.jpg
-roughness_map Roughness.png
-normal_map Normal.jpg

这里是选项的完整列表(在终端中输入 xcrun usdz_converter -h):

-g groupName [groupNames ...]        Apply subsequent material properties to the named group(s).
-m materialName [materialNames ...]  Apply subsequent material properties to the named material(s).
-h                                   Display help.
-a                                   Generate a .usda intermediate file.  Default is .usdc.
-l                                   Leave the intermediate .usd file in the source folder.
-v                                   Verbose output.
-f                    filePath       Read commands from a file.
-texCoordSet          set            The name of the texturemap coordinate set to use if multiple exist (no quotes).
-opacity              o              Floating point value 0.0...1.0

-color_default        r g b a        Floating point values 0.0...1.0
-normal_default       r g b a        Floating point values 0.0...1.0
-emissive_default     r g b a        Floating point values 0.0...1.0
-metallic_default     r g b a        Floating point values 0.0...1.0
-roughness_default    r g b a        Floating point values 0.0...1.0
-ao_default           r g b a        Floating point values 0.0...1.0

-color_map            filePath
-normal_map           filePath
-emissive_map         filePath
-metallic_map         filePath
-roughness_map        filePath
-ao_map               filePath

现在模型完美运行。

enter image description here

关于xcode - USDZ 文件未在 iPhone 7 上加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53345279/

相关文章:

c++ - Xcode C++ 调试

ios - iOS 增强现实中的多个文本

swift - 是否有将 RealityKit 实现到 Swift Playground 的好方法?

ios - 为什么这段代码在 Xcode 模拟器上可以运行,但在设备上却不能运行?

objective-c - 如何隐藏/关闭 NSWindowController 及其 View ?

xcode - 如何在模拟器上测试 iOS 麦克风的使用情况?

unity3d - Vuforia 中的增强现实

java - 从 3d 数组获取边界信息

从校准的相机图像进行 3d 重建

c++ - 在 3d 空间中的 QT 中围绕其 Y 轴旋转小部件