ImportMesh from babylon file

Hi,

I am importing babylon file with BABYLON.SceneLoader.ImportMesh, it loads without errors but without textures.

I double checked that babylon json file have stored textures in base64 format, it is 170Mb in size.

I am importing it in the same environment where I saved that babylon file.

What am I doing wrong?

Please help.

Very hard to say without a reproduction! Want to share the model with the rest of us? we will be able to debug it.

Hi,

I can upload my babylon file somewhere if that it is what you mean?

1 Like

exactly that! preferably a server that will be able to deliver the file to the playground, so we can playa round with the model

here it is:

babylon format test file

It uses node material, just to mention, maybe there is a problem somewhere.

Thank you for your kind help. :smiley:

would be helpful if you could upload it to dropbox so that it can be imported in the playground

1 Like

Here it is on Dropbox:

https://www.dropbox.com/scl/fi/lxq92abi11cne989r306z/test.babylon?rlkey=vwp9vxjjx3n8z41f6wok6z7uk&st=64091ky1&dl=1

Here is the same file over https:

https://amethyst.mediacom.hr/test.babylon

The dropbox link didn’t want to load as was, changing to https://dl.dropboxusercontent.com solved it.

Here’s a playground with your asset:

What materials are you expecting? When loading it there are some meshes that have no material applied, such as this:

If you apply them to the texture you linked (by name), you get some missing textures. I suppose that’s because you have your textures on localhost which are not exported (see the 2nd picture below). I think that should be solved by toggling the “embed static texture” to on (which I assume would link it when exporting the file).


1 Like

Thank you for your effort.

I created node material in NME but later in code I change textures, so they are not the same like in NME.

How can I force embeding those textures that are applied during runtime?
Is there any property like embedStaticTexture?

Actually when I load that babylon file, meshes does not have material assigned to them, altough materials are loaded and visible in Inspector.

If I assign materials manually in Inspector it is ok, as it should be.
Why are those material assignments missing?

Just for your reference those materials have similar name to meshes, their names consist of “NM_” + mesh.name

Hello! This seems to be a bug in the serialization of the NodeMaterial.

Parsing of the NodeMaterial when loading a .babylon file relies on the uniqueId of the mesh. Since this property is not serialized, it loads the material but when trying to attach the material to the mesh it can’t find the mesh identified by the an non-existing uniqueId (has a value of undefined). It is serialized when using the StandardMaterial.

@deltakosh @sebavan @Evgeni_Popov shouldn’t this be revised? Relying on an uniqueId which was serialized and later at load time of the babylon file enforced, could result in duplicate uniqueIds on the scene.

Both PGs loads the same babylon file. Only difference is that the second one has the uniqueId serialized.

This fixes the issue, however I’m still scratching my head what could be the reason to use the uniqueId when loading the babylon file. Was it an intention?

thanks!

2 Likes

Hi and thank you. :smiling_face:

These fix will be in new release?

Already merged.

1 Like