question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Questions on embedded GLTF PBR Texture

See original GitHub issue

Just now, I exported GLTF material from Blender, and during conversion, I am getting this error:

Traceback (most recent call last):
  File "gltf2usd.py", line 1126, in <module>
    convert_to_usd(args.gltf_file, args.usd_file, args.fps, args.scale, args.verbose)
  File "gltf2usd.py", line 1114, in convert_to_usd
    GLTF2USD(gltf_file=gltf_file, usd_file=usd_file, fps=fps, scale=scale, verbose=verbose)
  File "gltf2usd.py", line 70, in __init__
    self.convert()
  File "gltf2usd.py", line 1099, in convert
    self._convert_materials_to_preview_surface()
  File "gltf2usd.py", line 482, in _convert_materials_to_preview_surface
    primvar_st1_output=primvar_st1_output
  File "gltf2usd.py", line 1074, in _convert_texture_to_usd
    texture_name = self.unpack_textures_to_grayscale_images(image_name, color_components)
  File "gltf2usd.py", line 1035, in unpack_textures_to_grayscale_images
    raise Exception('Unsupported image type!: {}'.format(img.mode))
Exception: Unsupported image type!: RGBA

So far, I have tested 3D GLTF from Sketchfab only and never had issue. Only today I am setting up the shader based on GLTF Blend example. Then I exported the object and getting an error. It does not seem to like RGBA, maybe I should change it to JPG?

screen shot 2018-09-05 at 1 01 18 pm

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
kcoleycommented, Sep 5, 2018

@enzyme69 yes what @ox says is correct since the logic initially assumes that you are using an ORM texture (occlusion: r, roughness: g, metallic: b). The texture logic definitely needs refactoring. I will look into that later today to make it more robust. But in the meantime, @ox solution should work.

2reactions
oxcommented, Sep 5, 2018

So the texture it’s failing on is the Ambient Occlusion png, which has 4 channels. The _convert_materials_to_preview_surface function goes in expecting to use the r component of the occulusionTexture image as the occlusion map, sees a 4 channel image, which jumps to logic trying to unpack a glossiness map.

I think if you change your ao.png to only be 3 channels, it should work

Read more comments on GitHub >

github_iconTop Results From Across the Web

GLTF Textures not binding · Issue #1 · TimLee9024/MCglTF
Another question, how can I use an embedded .glb without setting this extras parameters and having the textures binded in game ? Thank...
Read more >
Crocotile3D, glTF and Hemispheric Lighting - Questions - Babylon.js
I created a fence post model in crocotile3d and exported it as glTF (also have the ... the material on an imported glTF...
Read more >
dae to gltf pbr export not exporting textures not base64
What i need is to create GLTF from dae and as pbr textures use textures from the /texture folder. Not sure if i'm...
Read more >
glTF 2.0 (GLTF/GLB) File – How can we help you? - CLO Help
Save textures as the glTF-Embedded format which includes texture files. Save with Zip Files (ZIP), Diffuse Color Combined on Texture. When color ...
Read more >
Everything You Need to Know About glTF Files - Marxent Labs
You can also embed glTF files in documents like Microsoft Word or ... Descriptions of the PBR material textures used to define the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found