3dsmax export to .gltf with tags

Hi everyone,

Not sure if I should post here or in the general question so please excuse me if you think this is not the right section.

I’m working on an architectural visualization tool and exporting my model from 3dsmax to gltf with the Babylon exporter. I’d like to use tags so I can easily find objects in Babylon.

I tagged a few objects in 3dsmax as “unit”. The 3d loads fine in Babylon but when I call scene.getMeshesByTags(“unit”); it returns an empty array.
I opened my gltf file and it seems like the tag is properly exported there on the objects I tagged: “extras”:{“tag”:“unit”}}.

I tried to create a box within babylonjs and tagged it with the addTags function. If I use getMeshesByTags after that it does find my box so I’m thinking there might be a problem with my gltf.

Has anyone tried to use tags with gltf from 3dsmax and did you run into any troubles?



pinging @kcoley (He will be back on monday so expect a bit of delay )

Hi @christopheC. Are you importing your glTF asset into Babylon.js and trying to filter on tags, or are you importing a .babylon asset. If the former, I am not sure if the glTF loader handles extras data as tags or not. @bghgary may be able to confirm this.
Have you tried importing a .babylon file to see if that works ?

@christopheC also do you have a sample max scene and/or generated glTF?

No, the loader does not load extras without user code. There is not a 1-to-1 mapping between the glTF hierarchy and Babylon, so this is up to the user to handle it in a loader extension. I can show how this is done in a playground if I can get an asset with tags.

Hi everyone,

Thanks for your quick reply!

@kcoley yes I’m importing my gltf into babylon.js and trying to filter on tags. I also thought that it could be a tag support issue from gltf vs babylon files but I also tried to export as babylon file format and didn’t have more luck.

@bghgary I was trying to put together an example in the playground but I can’t get the gltf to load my file in the playground. I think it’s a problem with the server I’m using to host my file… I need to look more into that.
Anyways, I have saved out a file with tags that you can use for testing purposes. It’s not the one I’m using in my project as it would be too big. There are 4 geometries in that file, two of them are tagged “Unit” and they are the ones I’d like to get with getMeshesByTags.
I saved it as gltf and babylon if you’d like to see the difference.



You can put the file on GitHub somewhere and then use the raw url to access it.

@christopheC looks like the exporter is exporting the tags as “tag” instead of “tags” in the babylon file, which is a bug. I’ll work on a fix for that.

@christopheC I just made a fix for 3ds Max on changing “tag” to “tags”.

Thanks @kcoley that was fast :slight_smile: I just gave it a try and it works fine on Babylon export.

Still doesn’t work on gltf/glb files but I’m guessing @bghgary might be able to help with that soon

I also managed to make a scene work in the playground using dropbox! https://www.babylonjs-playground.com/#8IMNBM#13

Here you go:


Perfect it works!

Thanks everyone I really appreciate your quick help!


Hi everyone,

digging up an old topic. I’m still using tags with gltf but it does seem like tags either don’t export or at not recognized in Babylon if the object has a multi material with multiple Ids in 3dsmax assigned to it. Is that the correct behavior?



Pinging @Drigax

Hi @christopheC,

that doesn’t sound like proper behavior. I would expect an object with tags should export with the tags regardless of the type of material used for it. Can you share a scene that reproduces this?

Hi Drigax,

Sorry i disappeared for a bit and just used a workaround to make my app work. Now that I have more time I can share with you a playground scene.

I created two boxes in 3dsmax, one with a multi sub material element (2 IDs) and one with a regular material. When going through objects only the one with the regular material returns something when I call BABYLON.Tags.HasTags()

Also, I always have to use the tagsExtension for tags to work, is that going to always be the case and is just a trick for me or will this eventually be implemented in Babylonjs?

Thanks in advance for your help!


Ah, I see. it looks like when we import the multi material mesh, we split it into two separate primitives, while the tags are on the parent transform node:

Which is technically correct, but I don’t know if this is ideal… @bghgary do you have any thoughts regarding this? Do we want to propagate the tags to the primitives?

I’m not sure. How would propagating the tags to the primitives help?

currently we have a glTF mesh containing tag data in its extras.

On export, that glTF mesh is split into multiple primitives, which are represented as Babylon Meshes while the extras data only lives on the parent TransformNode.

Our API doesn’t seem to elegantly expose a way to query all TransformNode derived objects in scene by tag.

Currently, @christopheC is querying all imported meshes in scene for the supplied tag , which doesn’t result in retrieving the split meshes.

Currently, i can see our possible solutions by either: 1) we can spotfix this by propagating our extras data to the primitives when we need to split them by material
2) we provide a “get node/TransformNode by Tag” that would support such a usecase.

Ultimately i think we’re running into a situation where babylon’s concept of a mesh isn’t quite equvalent to glTF’s concept of a mesh.

1 Like

That seems like the better option.