Sections
Information on sections in MLOD P3D files, supplementary to the community wiki
Last updated
Information on sections in MLOD P3D files, supplementary to the community wiki
Last updated
This page is meant to supplement and clarify certain informations written on the community wiki about model sections, prior knowledge of that article is required.
According to the community wiki:
A section is essentially a combination of material and texture, which contains one specific shader, with it is specific settings and maps.
This definition is mostly correct, but doesn't explain the phenomenon of section duplication (indicated in the Resource Library of Object Builder), which is often deemed to be a bug by modders (this doesn't seem to be the case).
When this happens, Object Builder displays multiple instances of the same texture-material pair as separate sections, with different face counts assigned to them. The community wiki definition offers no explanation for this.
After some testing, it's clear that the section duplication shown in the above example is because the sections are mixed together in the face list of the P3D LOD.
Therefore perhaps a better definition would be:
A section is a collection of faces in a P3D LOD, using the same texture+material pair, and written contiguously in the face list of the P3D file.
In the MLOD P3D format the mesh faces are stored in a list. Each face definition contains the path to the assigned texture and material file.
For more info on the P3D format, read the community wiki.
Suppose we want to have a simple cube with 6 faces, and 2 materials (3-3 faces each).
Ideally, every face belonging to the same texture-material pair should be written contiguously in the file. This would result in the lowest number of sections, 2 in this case.
However, if we copy-paste geometries in the LOD in Object Builder, or a 3rd party software of our choice doesn't group the faces based on their materials during exports, the face list may become fragmented. In this case the faces otherwise belonging to different sections end up being mixed after one another. This leads to more sections. In the worst case scenario (when faces from different sections are alternating one by one), it may lead to almost as many sections as faces, 6 in our example.
How much this is optimized during coversion to ODOL format is not certain, but inspection of files shows that fragmentation might not be reliably resolved during the process, especially considering the issue of alpha face order.
A model with 13 sections (originally 5, if it wasn't fragmented) ended up with 7 sections after the conversion to ODOL, according to Mikero's Eliteness.
Since the section count tends to have a significant impact on performace, it's important to minimize it. When using tools to export to P3D format directly, we should use one that makes sure the sections are not mixed together (like the Arma 3 Object Builder for Blender by me), or use the sorting option included in Object Builder itself (Faces >> Sort
). This will collect the faces belonging to the same texture-material pair, and reorder the face list accordingly.