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.
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?
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.
@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
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.
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.
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.
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.
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.
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?