kcoley / gltf2usd

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

AttributeError: 'OcclusionTexture' object has no attribute 'get_strength' #86

Closed ghost closed 5 years ago

ghost commented 5 years ago

I get a new errror when trying to convert an gltf to usd.

Any idea where it could come from?


converted usd file extension from .usdz to .usdc: /var/app/current/tmp/9292b98543fcb47a2818f62cd71f62e03818eda225d96f818cb98c2cbfa9b98d/usdz/dist.usdc
Traceback (most recent call last):
  File "/usr/local/gltf2usd/Source/gltf2usd.py", line 808, 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)
  File "/usr/local/gltf2usd/Source/gltf2usd.py", line 757, 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)
  File "/usr/local/gltf2usd/Source/gltf2usd.py", line 74, in __init__
    self.convert()
  File "/usr/local/gltf2usd/Source/gltf2usd.py", line 727, in convert
    self._convert_materials_to_preview_surface_new()
  File "/usr/local/gltf2usd/Source/gltf2usd.py", line 440, in _convert_materials_to_preview_surface_new
    usd_material.convert_material_to_usd_preview_surface(material, self.output_dir)
  File "/usr/local/gltf2usd/Source/_gltf2usd/usd_material.py", line 21, in convert_material_to_usd_preview_surface
    usd_preview_surface = USDPreviewSurface(self._stage, gltf_material, self, output_directory)
  File "/usr/local/gltf2usd/Source/_gltf2usd/usd_material.py", line 41, in __init__
    self._initialize_from_gltf_material(gltf_material)
  File "/usr/local/gltf2usd/Source/_gltf2usd/usd_material.py", line 103, in _initialize_from_gltf_material
    self._set_occlusion_texture(gltf_material)
  File "/usr/local/gltf2usd/Source/_gltf2usd/usd_material.py", line 146, in _set_occlusion_texture
    occlusion_strength = occlusion_texture.get_strength()
AttributeError: 'OcclusionTexture' object has no attribute 'get_strength'
🍎      USDZ created: /var/app/current/tmp/9292b98543fcb47a2818f62cd71f62e03818eda225d96f818cb98c2cbfa9b98d/usdz/dist.usdz```
kcoley commented 5 years ago

@sayduck-daniel thanks for flagging. I'll push a fix asap

kcoley commented 5 years ago

@sayduck-daniel should be fixed now

ghost commented 5 years ago

Awesome, gonna try it now.

ghost commented 5 years ago

Now I can get an USDZ but this USDZ can't be read on my iPhone.

ghost commented 5 years ago

I took my gltf not working on iPhone and I removed my metallicRoughnessTexture and occlusionTexture. When doing like that, it works again.

FYI: the map used for metallicRoughnessTexture and occlusionTexture is the same. It's a map I create with imagemagik command line:

convert occlusion.jpg roughness.jpg metalicness.jpg -background black -channel RGB -combine orm.jpg
ghost commented 5 years ago

FYI: when I take that gtlf, remove the metallicRoughnessTexture, remove occlusionTexture, convert and send to my phone, then it works again

kcoley commented 5 years ago

@sayduck-daniel do you have a sample model? I wasn't able to reproduce locally with this quick model I made: testORM.zip

ghost commented 5 years ago

I could send it to you privately, do you have an email or somewhere I could send it to you?

On 27 Oct 2018, at 18.15, Kacey Coley notifications@github.com wrote:

@sayduck-daniel do you have a sample model? I wasn't able to reproduce locally with this quick model I made: testORM.zip

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

kcoley commented 5 years ago

@sayduck-daniel sure you can direct message me on Twitter. My username is kaceylefty

ghost commented 5 years ago

@kcoley seems like I can't DM you if you are not following me as well. https://twitter.com/IsTheRealDan

kcoley commented 5 years ago

@sayduck-daniel I see, just followed you.

ghost commented 5 years ago

While trying to re produce the bug, I just realised the reason. The USDZ was created correctly (that explains why on mac it's previewable) but the maps were too heavy (4096x4096 maps for the ORM for 1.6 MB).

We are now converting all our maps to 2048 x 2048 jpegs.