MDL file format (MSFS)

From FSDeveloper Wiki
Revision as of 13:51, 25 March 2021 by Arno (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

MDL sections

MSFS uses glTF files for models, but when these are combined to BGL file for use in scenery they are still wrapped as MDL files. These MDL files have a similar RIFF container structure as FSX MDL files. The table below shows the different sections and their content.

MSFS MDL sections
Section Content
GXML This section contains the model XML file. Within this XML the object GUID, the levels of detail and the animations used are defined.
GLBD This section contains all the representations of the object. It is a collection of GLB sections, one for each level of detail.
GLB This section contains the binary glTF data of the object for a specific level of detail. It is stored as a binary glTF file, which means that the JSON glTF data and the binary BIN data are combined in one binary file. This binary file is stored in this section.

glTF standard exceptions

Although the glTF files are stored in binary form inside the MDL files, there are a number of optimizations that the MSFS package tool performs that makes them deviate from the glTF standard. The list below gives an overview of these differences.

Non standard elements packaged MSFS glTF files
Topic Description
Texture coordinates Texture coordinates are stored as half precision (16 bit) floating point values in the binary data. The JSON glTF data specifies that the data is stored as a short, but it should thus be read as a half precision float. A consequence of using half precision floats is that the accuracy for the texture coordinates is that larger values are stored much less accurate. This can lead to artifacts when textures are tiled many times on a polygon.
Non-uniform node scaling When a node has a non-uniform scaling, e.g. the different axes are not scaled with the same factor, the package tool does optimize the binary vertex data. The vertex positions are modified so that they can be scaled with the average value of the non-uniform scaling. So for example when the scaling is 1.0 around the X axis, 5.0 around the Y axis and 3.0 around the Z axis, the vertex positions are stored in the binary data in such a way that a uniform scaling of 3.0 can be applied. But be aware, the scaling of the node as specified in the JSON glTF data does still contain the non-uniform scaling values!