Jump to content

BABYLON.GLTF2Export with texture issue <- Feature or Bug?


Adrian3D
 Share

Recommended Posts

Hello Babylon community,

I have been working with the BABYLON.GLTF2Export feature (which is by the way great to have!!!), and noticed an odd behavior of which I am not sure if it is intended.

Check out this playground: http://www.babylonjs-playground.com/#1GXSPK#16

It will create a simple scene with a texture and download the following 3 files to your computer:

  1. MyFile.gltf

  2. MyFile.bin

  3. _textures_BJS-logo_v3.png.png

So texture image files are renamed during export by their folder path and file extension (in our example from "./textures/BJS-logo_v3.png" to _textures_BJS-logo_v3.png.png ")

 

If I then try to open / drag and drop these in the sandbox https://sandbox.babylonjs.com, I get the following error message:

#/images/0/uri: Failed to load './textures/BJS-logo_v3.png.png': 0

Changing line 169 in the file "MyFile.gltf"

  • From: "uri": "./textures/BJS-logo_v3.png.png"

  • To: "uri": "_textures_BJS-logo_v3.png.png"

makes it work again in the sandbox and other software.

 

Maybe the intention here is to indicate with "_textures_" that the image texture was originally in the sub-folder texture, but you cannot open the gltf-file any more like that.

In my opinion the BABYLON.GLTF2Export should either

  • Leave the texture file names as is (e.g. "./textures/BJS-logo_v3.png") so that as a user I have to save the gltf in the correct folder (typically relative to the Babylon HTML-app) and NOT include them in the export (i.e. only two files are downloaded), or

  • Include the textures in the export but fix the uri to the correct relative value.

Just a proposal to save others the time I spent figuring this out.

Link to comment
Share on other sites

Hi @Adrian3D, the change has been merged to master.  It turned out to be a behavior with the browsers, where Chrome replaced the slashes with underscores, whereas Edge tried to keep the original slashes but had issues actually downloading the textures.  To make the export behavior consistent, I changed all slashes and dots to underscores.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...