P3D Lod Sections

From Bohemia Interactive Community
Revision as of 15:37, 17 November 2021 by Lou Montana (talk | contribs) (Text replacement - " (\=+)([a-zA-Z0-9][^ ]+[a-zA-Z0-9])(\=+) " to " $1 $2 $3 ")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
bi symbol white.png
Disclaimer: This page describes internal undocumented structures of Bohemia Interactive software.

This page contains unofficial information.

Some usage of this information may constitute a violation of the rights of Bohemia Interactive and is in no way endorsed or recommended by Bohemia Interactive.
Bohemia Interactive is not willing to tolerate use of such tools if it contravenes any general licenses granted to end users of this community wiki or BI products.

LodSection

LodSection
{
 ulong FaceIndexOffsets[2];     // from / to region of LodFaces used
 ulong MaterialIndexOffsets[2]; // ODOLV4x only
 ulong CommonPointsUserValue;  // see P3D Point and Face Flags
                               // 0xC9 -> LodPoints 0x0C90003F
                               // LodPointFlags are in a separate table for arma, and in the VertexTable for Operation Flashpoint (odol7)
 short CommonTextureIndex;     //
 ulong CommonFaceFlags;        // see P3D Point and Face Flags
 ///////// // ODOLV4x only//////
 long  MaterialIndex;
 if MaterialIndex ==-1
 {
   byte ExtraByte;
 }
 ulong UnknowLong;             // generally 2
 float UnknownResolution;
 float UnknownResolution2;     // generally 1000.0
 ### V67 ###
     ulong   UnknownLongValue1
     if UnknownLongValue1
     {
         CollimatorInfo   unknown //Vec3,Vec3,ulong,vec3,ulong
     }
 ###########
 ////////////////////////////////
}
  • a Material or Texture index with default value (-1) has no face/material associated with it and consequently the bounds are zero
  • In odol7 TextureIndexes and FaceFlags existed for every LodFace in the LodFace Structure, and repeated (as a block) here.
  • In Arma they are removed from the LodFaces.


FaceIndexOffsets

LodFaces are organised sequentially, in blocks.

The 1st block of faces use the 1st section and so on.

If there are any faces specified at all (a memory lod doesn't have them), there must be, at least one section in that lod. If it is the only section, it will span the entire lodface structure.


FaceIndexOffsets contain relative memory offsets of the faces used in this section.

Each subsequent section (if any) uses the next, sequential block.

Because Faces contain either triangles, or, quads. The amount of data in each block is variable.

A face quad uses 10 bytes, a face triangle uses 8.

Example:

  • this section uses the first two faces of the face structure;
  • Face 0 = triangle (8 bytes)
  • Face 1 = box (10 bytes)
  • Face 2 (if any) next section (if any)
Lower Offset = 0    // ie start of the face structure since this is the 1st section
Upper Offser = 8+10 // bytes start of next section (if any) or end of faces

The next section (if any) will contain:

Lower Offset = 8+10 // beginning of this block
Upper Offset = 8*nTriangles.ThisBlock+ 10* nQuads.ThisBlock

etc

Related Page(s)

Model File Formats