plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.

Please take a moment to read the platform’s guidelines before you get started!


PuffinFlight avatar image
PuffinFlight asked Thalixte edited

Multiple GLTFs with one BIN = compiler error

I'm creating variants of my models. They differ only with the material, so I thought that I'd need only one BIN file for many variants of GLTF files. I guess it will save memory etc. Tested it and it worked fine... until...
Here comes LODs. After adding LOD lines to XML it can't be compiled anymore (no bin file found error). Looking at the content of the temporary file, the BIN generated by the compiler has the wrong name. Probably taken from XML file instead of the one that is linked in GLTF file that points to it.
The only solution, for now, is to create pair of GLTF and BIN files. I'll repeat that it occurs only when using LODs.
Any ideas on how to fix this? Or maybe I'm overreacting and it has no impact on performance?

PS: I'm using the external compiler, not the in-game one
PPS: One more update.
I've tried in-game compiler and it was better... kinda. With one model it worked, but with another prepared exactly the same way it didn't, giving me:

"AssetGroups | Failed to update all timestamps for files used in a command"

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image FlyingRaccoon ♦♦ commented ·
Hello Puffin,

From what I can see in the code, it should work even if it ends up duplicated in the BGL format. You would still gain some disk space.
I'm not sure about what's causing the AssetGroups error and why the behaviour is different between the ingame builder and the external one.

Can you provide me with your package so I can check what's happening?


1 Like 1 ·
PuffinFlight avatar image PuffinFlight FlyingRaccoon ♦♦ commented ·

I'll prepare the test package next week as the main one is quite big and complex.
IIRC the "AssetGroups error" appears in in-game compiler, but the external compiler says that it couldn't get access to BIN file (it tries to open the file that doesn't exist because it takes the same name as the GLTF file instead of the BIN name that is inside of GLTF.

0 Likes 0 ·
FlyingRaccoon avatar image FlyingRaccoon ♦♦ PuffinFlight commented ·
Awesome. I'll track both issues with your package and will let you know if there's a workaround. Just tag me when you upload it.

Thanks ;)

0 Likes 0 ·
Show more comments
Thalixte avatar image Thalixte commented ·

I have a similar error message ("Failed to open file F:\MSFSProjects\Licorne\_PackageInt\_tempFiles\thalixte-licorne\licornemodellib\30604062536271726_LOD02.bin to get the last modification date" ) the first time i build the package. This bin file is shared across two gtlf file. Rebuilding it a second time fixes it. I precise i use the external compiler.

0 Likes 0 ·
PuffinFlight avatar image PuffinFlight Thalixte commented ·

I guess BIN that is shared has the same name as one of GTFLs? In that case, you're just lucky that it gets compiled first based on its GTFL name. But if the first compiled GTFL is the one without BIN of the same name, the compiler will throw an error.

0 Likes 0 ·
Thalixte avatar image Thalixte PuffinFlight commented ·

Thks for your answer. I know it is a little bit tricky, and maybe i am a lucky guy :)

But in fact, i recompile two times in a row (the first compilation displays the errors you are talking about).

Let's explain what i did exactly:

At first, for each tile (which represents a specific scenery 3dmodel), i have a xml file (describing the guid and binding the lods), and 3 or 4 lod models (with one gltf file and one bin file for each of them). The collision tag was set on the gltf file corresponding to the more detailed LOD, but it can tax the CPU perfs when such a LOD is displayed, due to the large amount of vertices and meshes for such a LOD.

So i changed this conception: i now remove all the road and collision tags in all the GLTF files correponding to the tile LODs. Then, i create a specific collider object for each tile, using the existing bin file corresponding to the less detailed LOD object.
In order not to increase the size of the project, i create a simple gtlf collider file, and an associated xml file (because it is a one LOD object), and bind the gltf file to the existing bin file corresponding to the less detailed LOD object (because it the one that contains the minimum number of meshes and vertices). On this collider object, i add the road and collision tags, as well as a transparent tag. So, this collider object needs two extra files: a dedicated xml file and a dedicated gltf file, with their names suffixed by "_collider".

It works exactly as expected, unless i must compile the project two times in a row.

I know i could create a specific material in each existing model, but it would increase the size of the project. Also, i have to make sure that the road traffic is displayed whatever the LOD.

0 Likes 0 ·
Thalixte avatar image
Thalixte answered

Intersesting indeed. I did the same to add colliders to existing models. But my colliders have only one LOD (the less precise one), so i did not experiment such an issue for the moment.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Thalixte avatar image
Thalixte answered tml commented

Also, even if two gltf refer to the same bin file, it seems to me that the memory footprint is the same as if they were using a distinct bin file (but maybe i am wrong). As of the number of drawcalls and the number of vertices, it behaves the same than if each gltf has its own bin file.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image FlyingRaccoon ♦♦ commented ·
That's accurate.

Our engine has its own system of common resources and it doesn't always match what can be done with the gltf format.
Common bin will reduce disk space and maybe simplify your edition but its content (at least for scenery objects) will be duplicated in the BGL.
That leaves us some room for improvement :)


3 Likes 3 ·
Thalixte avatar image Thalixte FlyingRaccoon ♦♦ commented ·
Thks a lot for confirming this point.
0 Likes 0 ·
tml avatar image tml FlyingRaccoon ♦♦ commented ·

This is perhaps a stupid question but what does in the BGL mean? Weren't *.bgl files used in older versions if Flight Simulator? Does MSFS still convert glTF to that format in-memory perhaps? (Sounds a bit weird to keep the restrictions I am sure there is in an old format, but OK, being in the software business myself, and working on a codebase that is partially almost 30 years old, I certain understand that it takes time to get rid of legacy...)

0 Likes 0 ·
FlyingRaccoon avatar image FlyingRaccoon ♦♦ tml commented ·

We still use BGL format for sceneries.
This format allows you to store models in MDL and GLTF format as buffers.
But these buffers will be duplicated if there are multiple instances of an object, hence no gain in memory footprint.
BGL format also seems extensible if we ever want to add something like instances in the future.


1 Like 1 ·
Show more comments
PuffinFlight avatar image PuffinFlight commented ·
If that's the case then it's not an issue at all. Maybe except disk space, but bin files are usually small, at least for my projects.

Would be cool if someone from the team confirmed that.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.