Problems with textures when importing GLTF/GLB into BabylonJS Editor

First I want to state that the BabylonJS Editor is a great tool! However, we are currently struggling with importing GLTF/GLB files. Since I don’t know if this is a bug or expected behavior, I post it in the “Questions” section.

Problem description: When importing a GLTF/GLB file, the textures are not imported correctly (i.e. the black/red error texture is shown instead).

Version of Editor used: Latest Desktop (Electron) Version (2.5.2)

Steps to reproduce:

Results:

  • While the GLB looks fine in the Preview window, the material/textures are not shown correctly when hitting the “Play” button:
  • At the same time the Texture Viewer does not show any Textures
  • In the Material Viewer one material is shown but with the same wrong black-red texture

We also tried the following without any positive effect:

  • Refreshing the materials or textures
  • Reloading the project
  • Using Scene > Import Meshes from… instead of drag’n’drop

Thanks in advance for any help/comments!

1 Like

Pinging @julien-moreau who is the author of the editor

Hey @Peregrin! I’m happy that you use the editor and thanks for the repro steps!

Found the problem. The GLTF loader creates temporary blob URLs for textures and remove theme directly. Then the editor will never retrieve them.

Maybe @bghGary can help. It’s there a way to store textures in FilesInput instead of creating temporary blob URLs? Via an option or whatever

Thanks

@julien-moreau I don’t understand why temporary blob URLs cause a problem. Can you elaborate?

I notice that the created textures have urls that don’t exist anymore (and their names are not necessary the same as the textures files near the gltf file).
With a simple .babylon file that’s easy to retrieve textures sources has they are in separated files and urls are simply the filenames of the textures files. Not the case of glb and not necessary the case in all gltf files (embedded textures).

It is needed for the editor to retrieve textures files (or sources) as it can export the scenes users are editing to preview (like above)

Do you think I should create files by traversing the gltf file myself?

Hope it is more clear :slight_smile:

The textures that come from a glTF/glb will not always have a url. I think you need to take the texture data and export it, similar to what the glTF serializer does.

Thanks @bghgary, will do that
@Peregrin fixing asap

1 Like

Hey @Peregrin,

Just fixed the issue in the editor, will release asap. Thanks @bghgary, I used your tip

2 Likes

@Peregrin will deploy the editor really soon

@julien-moreau Great to hear, thanks very much! Looking forward to check out the fix.

@Peregrin will be available in the 3.0.0
Will share a link to download the preview versions before the official 3.0.0 :slight_smile:

@julien-moreau Great, thank you!

@Peregrin the v3.0.0 is out!!
Can be downloaded here: Getting Started - Babylon.js Documentation