kcoley / gltf2usd

command-line utility for converting glTF 2.0 models to USD
MIT License
263 stars 39 forks source link

USDZ animation works on MacOS but not on iOS: Multiple Meshes and Single Armature #116

Open enzyme69 opened 5 years ago

enzyme69 commented 5 years ago

puppet_share.zip

It's driving me mad when USDZ works on MacOS, but simply crashes on iOS without any error handling,...

The scene is basically some kind of flat puppets and everything is simple:

screen shot 2018-12-05 at 11 33 15 pm

puppet_share.zip

Not sure why it crashes on iOS...

kcoley commented 5 years ago

@enzyme69 hmm, I am not sure why this is crashing on iOS, yet animates fine on Mac OS :/ This may be a bug or discrepancy with iOS's AR Quicklook implementation. Perhaps you can file a bug with Apple?

enzyme69 commented 5 years ago

Ok I will try doing that. As for iOS 12.1.1, it's still crashing.

Not sure if this related to previous thread on: not to use multiple color objects or something. Maybe not.

enzyme69 commented 5 years ago

I tried joining all the meshes into a single mesh, hoping that a single mesh + a single bone chain would do it, but when converting the GLTF, I am getting this error:

Traceback (most recent call last):
  File "gltf2usd.py", line 806, in <module>
    convert_to_usd(os.path.expanduser(args.gltf_file), os.path.abspath(os.path.expanduser(args.usd_file)), args.fps, args.scale, args.arkit, args.verbose, args.use_euler_rotation, args.optimize_textures)
  File "gltf2usd.py", line 754, in convert_to_usd
    usd = GLTF2USD(gltf_file=gltf_file, usd_file=usd_file, fps=fps, scale=scale, verbose=verbose, use_euler_rotation=use_euler_rotation, optimize_textures=optimize_textures)
  File "gltf2usd.py", line 55, in __init__
    self.gltf_loader = GLTF2Loader(gltf_file, optimize_textures)
  File "/Users/jimmygunawan/Desktop/puppet_share/_gltf2usd/gltf2loader.py", line 118, in __init__
    self._initialize()
  File "/Users/jimmygunawan/Desktop/puppet_share/_gltf2usd/gltf2loader.py", line 124, in _initialize
    self._initialize_materials()
  File "/Users/jimmygunawan/Desktop/puppet_share/_gltf2usd/gltf2loader.py", line 159, in _initialize_materials
    material = Material(material_entry, i, self)
  File "/Users/jimmygunawan/Desktop/puppet_share/_gltf2usd/gltf2/Material.py", line 115, in __init__
    self._pbr_metallic_roughness = PbrMetallicRoughness(material_entry['pbrMetallicRoughness'], gltf_loader) if ('pbrMetallicRoughness' in material_entry) else None
  File "/Users/jimmygunawan/Desktop/puppet_share/_gltf2usd/gltf2/Material.py", line 67, in __init__
    self._base_color_texture = Texture(pbr_metallic_roughness_entry['baseColorTexture'], gltf_loader) if ('baseColorTexture' in pbr_metallic_roughness_entry) else None
  File "/Users/jimmygunawan/Desktop/puppet_share/_gltf2usd/gltf2/Material.py", line 17, in __init__
    self._image = gltf_loader.get_images()[texture_entry['index']]
IndexError: list index out of range
enzyme69 commented 5 years ago

The issue seems to be resolved after I deleted one of the material that might be overlapping with the mesh. So I can convert the GLTF to USDZ.

And... the resulting USDZ is now working actually! One mesh, one armature is good.

img_2677

CONCLUSION for now: Multiple meshes skinned into a single armature is not working on iOS, can still work on MacOS.

I am sending this "bug" to Apple.