3dsmax exporter to gltf with instances

Hi all,

I’m currently working on a project and exporting from 3dsmax to gltf with the babylon exporter (versino v20191203.3).

I’m using lots of instances in order to minimize the size of my gltf file. I think that the exporter used to skip instances (or at least export only one of them) in order to save filesize so the gltf file would be the same size if I had one object or 10 times the same object instanced.

It doesn’t seem to be the case with this version anymore.

Did anyone run into that issue?



Pinging @Drigax

Thanks for the report @christopheC,

I ran the latest exporter against my Instance testing scene, but I don’t notice any regressions. What specifically is happening with your instance export? Do you have a scene that may show this?

Hi Drigax,

please see on Mediafire a few files that you can use to reproduce my problem.

InstancesToExport.max contains grouped geometries which I instanced and am trying to export
“one floor.gltf” and “one floor.bin” is the export of only one floor and is 880kb
“all floor.gltf” and “all floor.bin” is the export of all the floors and is 12mb

My understanding is that the exporter would leverage the power of instancing and only export a file a bit bigger than 880kb (basically only one floor) and then instance/clone the rest back in Babylon.

Please let me know if you have any question.



Thanks for sharing. This looks like a blast from the past in Instances with unique materials not working if exported in one file · Issue #541 · BabylonJS/Exporters · GitHub, where we preserved instances, but only for meshes that don’t share materials. At the time, I assume that the babylon engine did not fully support mesh instances that did not share materials.

Not the best solution in retrospect.

@Deltakosh, what are the current limitations of instances in Babylon? Should we modify the format to add an “overrideMaterialId” field to mesh instances that contains a material GUID to support this case? It would also make it trivial to support proper instances in glTF as well.

otherwise, it would also be easily addressable by adding this field to be exporter-only, to pass to the glTF exporter

Instances must share the same material of their root. If they are not sharing the material then we must clone them and this is less efficient

Thanks for the info. The objects I’m trying to instance do share the same materials though so I’m not sure why it behaves this way.

I created the main object, applied a material and then instanced it so they should be exactly the same.


Yep this is the correct expected behavior

so should all these objects be imported as instances or as copies (in which case the file size is much bigger)?
Currently they seem to be imported as copies as the filesize increases by the amount of geometry I export.

I would expect that only one piece of geometry is exported by instance.

Please let me know what you think.



I agree with that expectation, if they’re all sharing material and textures and are configured as instances in 3dsMax, then they should be exported as instances as well.

I’ll have to look at our export process to see why this isn’t the case.

1 Like

Hi @christopheC, looking at the scene, I’m not sure if the meshes are properly instanced:

If I compare with my test scene, I am able to select a single mesh in scene, and using Edit->Select instances to select the rest of the meshes in scene.

But I don’t seem to be able to do the same for any mesh used in the scene you shared:

Can you double check to see if your meshes are properly instanced in the 3dsMax scene?

Hi Drigax,

By default max won’t allow you to select instances of multiple objects selected (not sure why).

In this example I have a box and a sphere which I instanced a few times. If I select one instance of each the menu is greyed out.

In the same context if I only select the box then I can select its instances.

In my file, each floor is a grouping of several objects which is why 3dsmax won’t let you select instances this way. If you were to open or explode the groups and only select one object then you’ll be able to select its instances this way.

I’d ideally like to preserve my groupings as it should allow me to make floor selections more easily.
I did try to break the groups and do an export but the instances are still not exported properly.

Thanks for your help on this.


Hey guys,

I have a problem which I think is related to the instancing export from 3dsmax.

Please let me know if you’d prefer me to open a new thread for it.

I’m working with instances of multiple floors of a tower. Each floor is a group of object (mullions, floor, walls, glass, etc.)

What I’d like to do is that when I click on one of the floor, all of the other ones disappear.

My problem is that it seems like babylon is hiding some objects when I run the script that it shouldn’t.

Please let me know what you think or if you see a better way to do it.



Ping @Drigax

Hey again Chris!

Regarding your playground scene, I made some modifications to the visibility setting logic, instead of setting visibility, I use the isVisible property to control this, I also added some logic to make it easier to test by resetting the visibility of all floors on nothing being picked. (this second behavior may need to be tweaked, we don’t want to reset visibility when the user click+drags) Is this closer to the behavior you want?


Regarding the 3dsMax export step, I think I understand what’s happening now. The materials used for my test scene were too simple, you use a Shell material in your scene, and that tricks the exporter, as we then export the meshes using the baked material input, but compare against other meshes in scene using that material, so each mesh is still exported.

I’ll open Instances of Meshes using Shell materials are exported as separate meshes. · Issue #709 · BabylonJS/Exporters · GitHub, I’m almost done with a fix, so I should be able to address this shortly.

Thanks Drigax that’s exactly what I was trying to do and the problem for the exporter does make sense.
I guess until that is fixed I can just apply the baked material on to my object instead of the shell to bypass the issue.

When it comes to isVisible and visibility, what’s the main difference? does visibility impact other instances when isVisible only affect one object?

I’m not totally sure. hey @Deltakosh, why should we use isVisible instead of directly changing visibility?

isVisible is a boolean: Fast but does not allow intermediate value. Visibility === 0 is equivalent to isVisible === false

Ok, @christopheC fix is going out soon. I just tested your scene against my fix, and we’re down to 880kb buffer size!
allFloors.zip (162.5 KB)

Fix is available now:

1 Like