OGeek|极客世界-中国程序员成长平台

标题: xcode - iPhone 7 上未加载 USDZ 文件 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 20:50
标题: xcode - iPhone 7 上未加载 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 .



Best Answer-推荐答案


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:

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 - iPhone 7 上未加载 USDZ 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53345279/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4