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”

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.

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.

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.

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? Regards, Sylvain

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.

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 :slight_smile: Regards, Sylvain

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 :wink:

Thks a lot for confirming this point.

I have a similar error message (“Failed to open file
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.

@FlyingRaccoon Here’s a test package » You’ll
find two cooling tower models. 18m ones have separate BIN files and compile
just fine. 36m have single BIN and throw errors. It looks like the compiler
while creating files in the temp folder, creates BIN files with a name taken
from the GTLF file name, not from the name of the BIN file written inside of
the GTLF file. Still, if it has no impact on FPS then it’s not that important.
My BINs are not that big. Even when I auto-generate 150 of them :wink:

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…)

Hello. 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. Regards, Sylvain

Ah OK. I have been working on aircraft only so I did not know that.

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.

Thks for your answer. I know it is a little bit tricky, and maybe i am a lucky
guy :slight_smile: 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.