{"name":"P3D File Format - ODOLV4x","title":"P3D File Format - ODOLV4x","type":"topic","url":"https://community.bistudio.com/wiki/P3D_File_Format_-_ODOLV4x","revid":378841,"updated":"2026-07-14T11:39:20Z","aliases":["ODOL v40 File Format","P3D File Format - ODOLV40 Revised"],"markdown":"> **Disclaimer: This page describes internal undocumented structures of Bohemia Interactive software.**\n>\n> This page contains unofficial information.\n>\n> 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.\n> 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.\n\n### Introduction\n\n#### Acknowledgements\n\nThis body of work is due to Synide's sweat and tears. To whom, all honour and glory.\nAbly assisted by T_D and Mikero that further detailed the data and gave this article a more general and correct structure.\n\n#### General\n\nThe general format of an Armed Assault's ODOLV4x p3d model is similar to the ODOLV7 (OFP) format.\nThe **major** differences are that Armed Assault models have:\n\n- the use of rvmat material files\n- an optional model.cfg, and\n- LODs occur in the file from highest to lowest LodType value.\n\n##### Legend\n\nsee Generic FileFormat Data Types\n\n##### Relative Coordinates\n\nAll coordinates are **relative** to ModelInfo.CentreOfGravity\n\n##### File Paths\n\n**All** file references are absolute to the Linux \\ (root).\n\nAs a convenience a drive letter is used (such as P:\\) for sanity when modelling.\nThe engine knows nothing about C:\\my documents or P:\\.\n\nThe leading \\ is generally optional.\n\nboth `\\my_project\\data\\some.paa` and `my_project\\data\\some.paa` point to the same file. All file references imply a beginning \\slash.\n\n#### Versions\n\nThis Document covers ODOL versions:\n\n##### V40 (Armed Assault)\n\n- Original Armed Assault binarised p3d\n\n### File Format\n\n```cpp\nODOLv4x\n{\n    StandardP3DHeader Header;\n    struct ModelInfo;\n    Animations        Animations;\n    ulong            StartAddressOfLods[Header.NoOfLods]; // offset relative to start of file.\n    ulong            EndAddressOfLods  [Header.NoOfLods];\n    LODFaceDefaults    LODFaceDefaults;\n    ODOLv40Lod        ODOLv40Lods[Header.NoOfLods];\n} // EndOfFile\n```\n\n### Structures\n\n#### StandardP3DHeader\n\nCommon header structure for all P3D file formats.\n\n```cpp\nstruct\n{\n    char[4]    Filetype;        // \"ODOL\"\n    ulong    Version;\n    ulong    NoOfLods;        // alias NoOfResolutions;\n}\n```\n\nModelInfo\n\n#### Animations\n\n```cpp\nAnimations\n{\n    tbool    AnimsExist;\n    if (AnimsExist)\n    {\n        ulong            nAnimationClasses; // eg NoOfAnimSelections;\n        AnimationClass    AnimationClasses[nAnimationClasses];\n\n        long        NoOfResolutions; // is -1 if nAnimationClasses == 0\n        Bones2Anims    Bones2Anims[NoOfResolutions];\n        Anims2Bones    Anims2Bones[NoOfResolutions];\n        // For every bone there is a list of Animations for each resolution\n        // And, a reversed table of every Animation gets a Bone.\n        // The reversed table optionally appends axis info dependent on the AnimTransformType\n    }\n}\n```\n\n#### AnimationClass\n\n```cpp\n    AnimationClass\n    {\n        ulong    AnimTransformType;\n        asciiz    AnimClassName;    // \"RightDoor\"\n        asciiz    AnimSource;        // \"rotor\"\n        float    MinMaxValue[2];\n        float    MinMaxPhase[2];\n        ulong    junk; // used to be sourceAddress, no longer, always 953267991\n\n        switch(AnimTransformType)\n        case 0://rotaton\n        case 1://rotationX\n        case 2://rotationY\n        case 3://rotationZ\n            float angle0;\n            float angle1;\n            break;\n\n        case 4://translation\n        case 5://translationX\n        case 6://translationY\n        case 7://translationZ\n            float offset0;\n            float offset1;\n            break;\n\n        case 8: //\"direct\"\n            float axisPos[3];\n            float axisDir[3];\n            float angle; //in radians whereas the model.cfg entry is in degrees\n            float axisOffset;\n            break;\n\n        case 9: //\"hide\"\n            float hideValue;\n            break;\n     }\n\n// corresponds to model.cfg\nclass CfgModels\n{\n    // ...\n\n    class whateverModel : Default\n    {\n     // ...\n     class Animations\n     {\n        class RightDoor // AnimClassName\n        {\n            type = \"translation\";    // AnimTransformType\n            source = \"rotor\";        // AnimSource\n            // etc\n        };\n    };\n};\n```\n\n##### Bones2Anims\n\n```\nBones2Anims\n{\n ulong        NoOfBones;\n Bone2AnimClassList   Bone2AnimClassLists[NoOfBones];\n}\n```\n\n##### Bone2AnimClassList\n\n```\nBone2AnimClassList\n{\n ulong NoOfAnimClasses;\n ulong AnimationClassIndex[NoOfAnimClasses]; // a (sometimes repeating) list of zero based indexes into above animation classes\n}\n```\n\n##### Anims2Bones\n\n```\nAnims2Bones\n{\n AnimBones AnimBones[Animations.nAnimationClasses];\n}\n```\n\n##### AnimBones\n\nevery lod contains an identical list of animation entries that declare the position and axis of the each animation classes\n\n```\nAnimBones\n{\n long SkeletonBoneNameIndex; // zero based index to the SkeletonBoneName name & parentname\n // equivalent to selection = \"LeftDoor\"; eg in the model.cfg\n /*\n ** SkeletonBoneNameIndex== -1 when no skeleton bone is for this Anim and (obviously?) no axis information follows.\n */\n if (SkeletonBoneNameIndex!= -1) && (AnimationClass.AnimTransformType != 8 || 9)\n {\n /*\n ** AnimationClass.AnimTransformType 8 (direct) and 9 (hide) never require axis information.\n ** This because the \"direct\" (type 8) already has axis info in it is AnimationClass structure,\n ** and \"hidden\" (type 9) clearly doesn't need it.\n */\n    XYZTriplet axisPos; //describes the position of the axis used for this anim\n    XYZTriplet axisDir;\n }\n}\n```\n\n#### LODFaceDefaults\n\n```\n tbool             UseDefault[Header.NoOfLods];\n FaceData\n {\n  ulong   HeaderFaceCount;\n  ulong   aDefaultLong;     //ffffffff or 6f 7a 80 fa eg\n  byte    UnknownByte;      //generally zero\n  byte    aFlag;            // zero or one\n  bytes   Zeroes[7];\n }[Number of false UseDefault's];\n```\n\nA face data struct only exists for those lods who's UseDefault is zero\n\n#### ODOLv4xLod\n\n```\n ODOLv4xLod\n {\n   ulong                         nProxies;\n   LodProxy                      LodProxies[nProxies];              // see P3D Lod Proxies\n   ulong                         nLodItems;\n   ulong                         LodItems[nLodItems];               // potentially compressed, except for v64 and later\n   ulong                         nBoneLinks;\n   LodBoneLink                   LodBoneLinks[nBoneLinks];\n   float                         UnknownFloat1;\n   float                         UnknownFloat2;\n   XYZTriplet                    MinPos;\n   XYZTriplet                    MaxPos;\n   XYZTriplet                    AutoCenterPos;\n   float                         Sphere;                            // same as geo or mem values in modelinfo, if this lod is geo or memlod of course\n   ulong                         NoOfTextures;\n   asciiz                        LodPaaTextureNames[NoOfTextures];  //\"ca\\characters\\hhl\\hhl_01_co.paa\"\n   ulong                         NoOfMaterials;\n   LodMaterial                   LodMaterials[NoOfMaterials];\n   LodEdges                      LodEdges;                          // compressed see P3D Lod Edges\n   ulong                         NoOfFaces;\n   ulong                         OffsetToSectionsStruct;            // see below\n   ushort                        AlwaysZero;\n   LodFace                       LodFace[NoOfFaces];                // see P3D Lod Faces\n   ulong                         nSections;\n   LodSection                    LodSections[nSections];            // see P3D Lod Sections\n   ulong                         nNamedSelections;\n   LodNamedSelection             LodNamedSelections[nNamedSelections]; //See P3D Named Selections potentially compressed\n   ulong                         nTokens;\n   NamedProperty                 NamedProperties[nTokens];          //See Named Properties\n   ulong                         nFrames;\n   LodFrame                      LodFrames[nFrames];                //see P3D Lod Frames\n   ulong                         IconColor;\n   ulong                         SelectedColor;\n   ulong                         special; // IsAlpha|IsTransparent|IsAnimated|OnSurface\n   byte                          vertexBoneRefIsSimple;\n   ulong                         sizeOfVertexTable;                 //(including these 4 bytes)\n   if (v5x)\n   LodPointFlags                 LodPointFlags;                     // Potentially compressed\n   endif\n   VertexTable                   VertexTable;\n }\n```\n\n##### VertexTable\n\nall arrays are subject to compression\n\n```\nstruct\n{\n   UvSet                         DefaultUVset;\n   ulong                         nUVs;\n   UvSet                         UVSets[nUVs-1];\n   ulong                         NoOfPoints;\n   XYZTriplet                    LodPoints[NoOfPoints];\n   ulong                         nNormals;\n   ulong                         nMinMax;\n   ulong                         nProperties;\n   VertProperty                  VertProperties[nProperties];       //optional related to skeleton\n   ulong                         Count;\n   VertexNeighborInfo            neighborBoneRef[Count];          //optional\n}\n```\n\n- All non zero counts counts are the same.\n- Points,PointFlags, Normals and UV1 arrays are an integral group, they are either all there, or not specified (RacetK.p3d, a FrameTime lod has no counts at all)\n- UV2,MinMax, VertProperties and Unknown are optional in the sense that their counts can individually be zero, else they are the same as the others\n- In Odol7 PointFlags are part of this stucture, in Arma, they are a separated table.\n\n##### CompressedFill Arrays\n\nLodPointFlags, LodUV's and LodNormals arrays are not only subject to the standard 1024 rule compression, but also have a fill byte.\n\n```\nstruct\n{\n ulong                         Count;\n tbool                         DefaultFill;\n if (DefaultFill)\n  type                         Array;          // default fill for all Counts\n else\n  type                         Array[Count];   // potentially compressed\n}\n```\n\nThe structure either contains a single set of type variables, or, an array of type variables. If a full array is declared (DefaultFill =false) then that array is subject to the 1024 rule as per normal.\n\n##### UVset\n\n```\nLodUV                     LodUV;\n```\n\n##### LodUV\n\n```\nCompressedFill type = UVPair // eg float U,V;\n```\n\n##### LodNormals\n\n```\n CompressedFill type = XYZTriplet\n```\n\n###### CompressedXYZTriplet\n\ncontains 3x 10 bit fields in a 32bit 'integer'\n\ncode for converting back to a standard XYZTriplet is:\n\n```\nvoid DecodeXYZ(ulong CompressedXYZ, XYZTriplet *triplet)\n{\n   double scaleFactor = -1.0 / 511;\n   trp->X=trp->Y=trp->Z=0.0;\n   int x=   CompressedXYZ       & 0x3FF;\n   int y = (CompressedXYZ>> 10) & 0x3FF;\n   int z = (CompressedXYZ>> 20) & 0x3FF;\n   if (x > 511) x -= 1024;\n   if (y > 511) y -= 1024;\n   if (z > 511) z -= 1024;\n   if (x) trp->X = (float)(x * scaleFactor);\n   if (y) trp->Y = (float)(y * scaleFactor);\n   if (x) trp->Z = (float)(z * scaleFactor);\n}\n```\n\n##### LodPointFlags\n\n```\nCompressedFill type = ulong bits\n```\n\nThis table is the equivalent of Oxygen's points->properties dialog box. It specifically stores the user values and other flags for that point.\n\nIn ODOl7 it was part of the vertex table. In ArmA, it is separate.\n\nSee P3D Point and Face Flags\n\n##### LodMinMax\n\n```\nCompressedArray\n{\n XYZTriplet     MinMax[Count][2]; // 2 == min vs max\n}\n```\n\n##### VertProperty\n\n```\nCompressedArray\n{\n ulong  index;// seen range 0..4\n ulong  a,b; // definite not floats. might be flags, or indices\n}\n```\n\n##### VertexNeighborInfo\n\n```\nCompressedArray\n{\n ushort  vertexIndex _posA;\n AnimationRTWeight _rtwA;\n ushort  vertexIndex _posB;\n AnimationRTWeight _rtwB;\n}\n```\n\n##### LodBoneLink\n\n```\nLodBoneLink\n{\n  ulong NoOfLinks;         //range 0..3\n  ulong Value[NoOfLinks];  //the 'Value' seems to reference the 'LodItems' structure, resulting in a circular-reference.\n}\n```\n\n##### LodMaterials\n\nBasically... A direct replication of the information in the given .rvmat file\n\nThe stages in the p3d include a default stage and a TI stage that are not normally listed in the rvmat.\n\nThe first stage (in the p3d) is unconditionally the default stage. It is defaulted to empty (RvMatName=\"\"), unless, specified in the rvmat\n\nThe last stage is the TI stage, and is also defaulted empty, unless specified in the rvmat.\n\nTI Stages were introduced for operation arrowhead. Lod Material Types 9 and 10 do not have a TI stage at all.\n\nNeither of these two special, hidden, stage types use uvsets. The transform matrix for them is defaulted empty (so-called 'TexGen0').\n\nWhen specified in the rvmat (class Stage0 and StageTI respectively), no class uvTransform is declared for them. It is assumed default empty.\n\nIn an rvmat, uvTransforms are ordinarily declared within each stage body.\n\nIn a P3D, identical UVTransforms are declared once, and multiple 'stages' refer to them. There is, always, a default UVSet0 Transform as the 1st entry. (IE some stages dont require uvsets)\n\nThis P3D style can, if preferred, be used in rvmat syntax as\n\n```\nclass TexGenX\n{\n  .......\n};\n```\n\n```\nclass StageZ\n{\n  .........\n  Texgen=X;\n};\n```\n\nwhere X and Z are numbers\n\n##### LodMaterial\n\n```\n LodMaterial\n {\n   asciiz            RvMatName;     // \"ca\\characters\\data\\soldier_captive_hhl.rvmat\"\n   ulong             Type;          // 9 == ArmA\n   D3DCOLORVALUE     Emissive;\n   D3DCOLORVALUE     Ambient;\n   D3DCOLORVALUE     Diffuse;\n   D3DCOLORVALUE     forcedDiffuse;\n   D3DCOLORVALUE     Specular;\n   D3DCOLORVALUE     Specular2;       //Usually same as Specular\n   float             SpecularPower;   //\n   ulong            PixelShaderId;   //See enumPixelShaderId\n   ulong            VertexShaderId;  //See enumVertexShaderId\n   LongBool          mainLight;     // 1 or zero\n   ulong             ul_FogMode;    /// 0..4\n   Asciiz            BiSurfaceName;   // \"ca\\data\\Penetration\\plastic.bisurf\"\n   LongBool          Arma1Mostly1;    //rarely zero\n   ulong             RenderFlags;     //Generally 0\n   ulong             nTextures;\n   ulong             nTransforms;     // always same as nTextures\n   LodStageTexture   StageTextures  [nTextures];\n   LodStageTransform StageTransforms[nTransforms];\n }\n```\n\nEach lodmaterial entry contains a default StageTexture and StageTransform as the first entry. It is not shown in the rvmat file and has no PaaTexture\nIt is the only entry if a SurfaceName exists.\n\n#### D3DCOLORVALUE\n\n```\nD3DCOLORVALUE\n{\n  float r,g,b,a;\n}\n```\n\n###### RenderFlags\n\n- Bit0:AlwaysInShadow (A1 only)\n- Bit1:NoZWrite\n- Bit4:NoColorWrite\n- Bit5:NoAlphaWrite\n- Bit6:AddBlend\n- Bit7:AlphaTest (clutter)\n- Bit8:AlphaTest64 (clutter)\n- Bit19:Road (a1only)\n- Bit11:NoTiWrite\n\n###### LodStageTexture\n\n```\nLodStageTexture\n{\n ulong  TextureFilter; // see below\n asciiz PaaTexture;    // \"ca\\characters\\data\\civil_tvreport_body_as.paa\n                       // alternatively \"#(argb,8,8,3)color(0,0,0,1,CO)\" (eg)\n ulong  TransformIndex;       // zero based, see below\n};\n```\n\nThe first stageTexture is a dummy entry. For N humanly readable stage classes, there are 1+N LodStageTextures\n\nTextureFilter maybe 1 of the following values.\n\n- 0: Point // sometimes\n- 1: Linear // rarely\n- 2: TriLinear // not seen\n- 3: Anisotropic (default)\n\n###### LodStageTransform\n\n```\n  LodStageTransform\n  {\n   ulong UVSource;\n   float Transform[4][3];//a DirectX texture space transform matrix\n  };\n```\n\nUVSource corresponds to the 8 possible uvsets available\n\n- 0 \"None\"\n- 1 \"Tex\" default\n- 2: \"Tex2\"\n- ........\n- 8:\"Tex8\"\n\n- Tex1..8 cannot be taken literally as uvsource 1..8. They can mean anything, according to the template and are scarcely encountered\n\n##### NamedProperty\n\n```\n struct\n {\n    Asciiz Property;// \"noshadow\" = \"1\" eg\n    Asciiz Value;\n }\n```\n\n- See Named Properties\n\n### Decompression\n\nsee Compressed LZSS File Format\n\nsee Compressed LZO File Format\n\nIn ODOL v40 format files, some of the data structures present in the file are compressed by using LZSS compression.\n\nUnlike pbo compression, in ArmA model files, one only knows the number of items to decompress, the expected output size (in bytes) and the expected checksum.\nWith this information and the size of a given data item one has the necessary information to expand the data to it is original format and size.\n\n> [!NOTE]\n> Data structures that are identified as being compressible will only be compressed if the 'expectedSize' is ≥ 1024 bytes.\n\n### Reference Tables\n\n#### Material Stages\n\nThe number of material stages is dependant on the type of Shader that is used to process the material by the ArmA game engine.\nA reference table is used when processing materials where depending on the shader specified the given number of stages should be processed.\n\n```\n refShaderStages\n {\n   int PixelShaderId;\n   int NoOfStages;\n };\n```\n\n| ID (Hex/Decimal) | Name | Description | NoOfStages |\n|---|---|---|---|\n| 0x00, 0 | Normal | diffuse color modulate, alpha replicate | 0 |\n| 0x01, 1 | NormalDXTA | diffuse color modulate, alpha replicate, DXT alpha correction | 0 |\n| 0x02, 2 | NormalMap | normal map shader | 3 |\n| 0x03, 3 | NormalMapThrough | normal map shader - through lighting | 3 |\n| 0x04, 4 | NormalMapSpecularDIMap | VBS2 only | 2 |\n| 0x05, 5 | NormalMapDiffuse | ? | 2 |\n| 0x06, 6 | Detail | ? | 1 |\n| 0x07, 7 | ? | ? | ? |\n| 0x08, 8 | Water | A1 only sea water | 2 |\n| 0x09, 9 | ? | vbs2 | ? |\n| 0x0A, 10 | White | A1 only | 0 |\n| 0x0B, 11 | ? | vbs2 | ? |\n| 0x0C, 12 | AlphaShadow | shadow alpha write | 0 |\n| 0x0D, 13 | AlphaNoShadow | shadow alpha (no shadow) write | 0 |\n| 0x0E, 14 | ? | vbs2 | ? |\n| 0x0F, 15 | DetailMacroAS | ? | 3 |\n| 0x10, 16 | ? | vbs2 | ? |\n| 0x11, 17 | ? | vbs2 | ? |\n| 0x12, 18 | NormalMapSpecularMap | ? | 2 |\n| 0x13, 19 | NormalMapDetailSpecularMap | Similar to NormalMapDiffuse | 3 |\n| 0x14, 20 | NormalMapMacroASSpecularMap | ? | 4 |\n| 0x15, 21 | NormalMapDetailMacroASSpecularMap | ? | 5 |\n| 0x16, 22 | NormalMapSpecularDIMap | Same as NormalMapSpecularMap, but uses _SMDI texture | 2 |\n| 0x17, 23 | NormalMapDetailSpecularDIMap | ? | 3 |\n| 0x18, 24 | NormalMapMacroASSpecularDIMap | ? | 4 |\n| 0x19, 25 | NormalMapDetailMacroASSpecularDIMap | ? | 5 |\n| 0x38, 56 | Glass | ? | 2 |\n| 0x3A, 58 | NormalMapSpecularThrough | ? | 3 |\n| 0x3B, 59 | Grass | Special shader to allow volumetric shadows to be cast on grass clutter | 0 |\n| 0x3C, 60 | NormalMapThroughSimple | ? | 0 |\n| 0xxx, 102 | Super | Arrowhead | 0 |\n| 0xxx, 103 | Multi | Arrowhead | 0 |\n| 0xxx, 107 | Tree | Arrowhead | 0 |\n| 0xxx, 110 | Skin | Arrowhead | 0 |\n| 0x6F, 111 | CalmWater | Arrowhead | 7 |\n| 0xxx, 114 | TreeAdv | Arrowhead | 0 |\n| 0xxx, 116 | TreeAdvTrunk | Arrowhead | 0 |\n\n### Enums\n\n```\n int enum VertexShaderId\n {\n    case 0: return \"Basic\";\n    case 1: return \"NormalMap\";\n    case 2: return \"NormalMapDiffuse\";\n    case 3: return \"Grass\";\n    case 8: return \"Water\";\n    case 11: return  \"NormalMapThrough\";\n    case 15: return \"NormalMapAS\";\n    case 14: return \"BasicAS\";\n    case 17: return \"Glass\";\n    case 18: return \"NormalMapSpecularThrough\";\n    case 19: return \"NormalMapThroughNoFade\";\n    case 20: return \"NormalMapSpecularThroughNoFade\";\n    case 23: return \"Super\";\n    case 24: return \"Multi\";\n    case 25: return \"Tree\";\n    case 30: return \"CalmWater\";\n    case 26: return \"TreeNoFade\";\n    case 29: return \"Skin\";\n    case 31: return \"TreeAdv\";\n    case 32: return \"TreeAdvTrunk\";\n }\n```\n\n### Links\n\nArticle Author - Sy (Synide) -- Sy 17:16, 11 August 2007 (CEST)\n\nOriginal ODOLv40 Article detailed by Bxbx (Biki'd by Mikero)","sections":[{"heading":null,"level":1,"markdown":"> **Disclaimer: This page describes internal undocumented structures of Bohemia Interactive software.**\n>\n> This page contains unofficial information.\n>\n> 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.\n> 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."},{"heading":"Introduction","level":3,"markdown":""},{"heading":"Acknowledgements","level":4,"markdown":"This body of work is due to Synide's sweat and tears. To whom, all honour and glory.\nAbly assisted by T_D and Mikero that further detailed the data and gave this article a more general and correct structure."},{"heading":"General","level":4,"markdown":"The general format of an Armed Assault's ODOLV4x p3d model is similar to the ODOLV7 (OFP) format.\nThe **major** differences are that Armed Assault models have:\n\n- the use of rvmat material files\n- an optional model.cfg, and\n- LODs occur in the file from highest to lowest LodType value."},{"heading":"Legend","level":5,"markdown":"see Generic FileFormat Data Types"},{"heading":"Relative Coordinates","level":5,"markdown":"All coordinates are **relative** to ModelInfo.CentreOfGravity"},{"heading":"File Paths","level":5,"markdown":"**All** file references are absolute to the Linux \\ (root).\n\nAs a convenience a drive letter is used (such as P:\\) for sanity when modelling.\nThe engine knows nothing about C:\\my documents or P:\\.\n\nThe leading \\ is generally optional.\n\nboth `\\my_project\\data\\some.paa` and `my_project\\data\\some.paa` point to the same file. All file references imply a beginning \\slash."},{"heading":"Versions","level":4,"markdown":"This Document covers ODOL versions:"},{"heading":"V40 (Armed Assault)","level":5,"markdown":"- Original Armed Assault binarised p3d"},{"heading":"File Format","level":3,"markdown":"```cpp\nODOLv4x\n{\n    StandardP3DHeader Header;\n    struct ModelInfo;\n    Animations        Animations;\n    ulong            StartAddressOfLods[Header.NoOfLods]; // offset relative to start of file.\n    ulong            EndAddressOfLods  [Header.NoOfLods];\n    LODFaceDefaults    LODFaceDefaults;\n    ODOLv40Lod        ODOLv40Lods[Header.NoOfLods];\n} // EndOfFile\n```"},{"heading":"Structures","level":3,"markdown":""},{"heading":"StandardP3DHeader","level":4,"markdown":"Common header structure for all P3D file formats.\n\n```cpp\nstruct\n{\n    char[4]    Filetype;        // \"ODOL\"\n    ulong    Version;\n    ulong    NoOfLods;        // alias NoOfResolutions;\n}\n```\n\nModelInfo"},{"heading":"Animations","level":4,"markdown":"```cpp\nAnimations\n{\n    tbool    AnimsExist;\n    if (AnimsExist)\n    {\n        ulong            nAnimationClasses; // eg NoOfAnimSelections;\n        AnimationClass    AnimationClasses[nAnimationClasses];\n\n        long        NoOfResolutions; // is -1 if nAnimationClasses == 0\n        Bones2Anims    Bones2Anims[NoOfResolutions];\n        Anims2Bones    Anims2Bones[NoOfResolutions];\n        // For every bone there is a list of Animations for each resolution\n        // And, a reversed table of every Animation gets a Bone.\n        // The reversed table optionally appends axis info dependent on the AnimTransformType\n    }\n}\n```"},{"heading":"AnimationClass","level":4,"markdown":"```cpp\n    AnimationClass\n    {\n        ulong    AnimTransformType;\n        asciiz    AnimClassName;    // \"RightDoor\"\n        asciiz    AnimSource;        // \"rotor\"\n        float    MinMaxValue[2];\n        float    MinMaxPhase[2];\n        ulong    junk; // used to be sourceAddress, no longer, always 953267991\n\n        switch(AnimTransformType)\n        case 0://rotaton\n        case 1://rotationX\n        case 2://rotationY\n        case 3://rotationZ\n            float angle0;\n            float angle1;\n            break;\n\n        case 4://translation\n        case 5://translationX\n        case 6://translationY\n        case 7://translationZ\n            float offset0;\n            float offset1;\n            break;\n\n        case 8: //\"direct\"\n            float axisPos[3];\n            float axisDir[3];\n            float angle; //in radians whereas the model.cfg entry is in degrees\n            float axisOffset;\n            break;\n\n        case 9: //\"hide\"\n            float hideValue;\n            break;\n     }\n\n// corresponds to model.cfg\nclass CfgModels\n{\n    // ...\n\n    class whateverModel : Default\n    {\n     // ...\n     class Animations\n     {\n        class RightDoor // AnimClassName\n        {\n            type = \"translation\";    // AnimTransformType\n            source = \"rotor\";        // AnimSource\n            // etc\n        };\n    };\n};\n```"},{"heading":"Bones2Anims","level":5,"markdown":"```\nBones2Anims\n{\n ulong        NoOfBones;\n Bone2AnimClassList   Bone2AnimClassLists[NoOfBones];\n}\n```"},{"heading":"Bone2AnimClassList","level":5,"markdown":"```\nBone2AnimClassList\n{\n ulong NoOfAnimClasses;\n ulong AnimationClassIndex[NoOfAnimClasses]; // a (sometimes repeating) list of zero based indexes into above animation classes\n}\n```"},{"heading":"Anims2Bones","level":5,"markdown":"```\nAnims2Bones\n{\n AnimBones AnimBones[Animations.nAnimationClasses];\n}\n```"},{"heading":"AnimBones","level":5,"markdown":"every lod contains an identical list of animation entries that declare the position and axis of the each animation classes\n\n```\nAnimBones\n{\n long SkeletonBoneNameIndex; // zero based index to the SkeletonBoneName name & parentname\n // equivalent to selection = \"LeftDoor\"; eg in the model.cfg\n /*\n ** SkeletonBoneNameIndex== -1 when no skeleton bone is for this Anim and (obviously?) no axis information follows.\n */\n if (SkeletonBoneNameIndex!= -1) && (AnimationClass.AnimTransformType != 8 || 9)\n {\n /*\n ** AnimationClass.AnimTransformType 8 (direct) and 9 (hide) never require axis information.\n ** This because the \"direct\" (type 8) already has axis info in it is AnimationClass structure,\n ** and \"hidden\" (type 9) clearly doesn't need it.\n */\n    XYZTriplet axisPos; //describes the position of the axis used for this anim\n    XYZTriplet axisDir;\n }\n}\n```"},{"heading":"LODFaceDefaults","level":4,"markdown":"```\n tbool             UseDefault[Header.NoOfLods];\n FaceData\n {\n  ulong   HeaderFaceCount;\n  ulong   aDefaultLong;     //ffffffff or 6f 7a 80 fa eg\n  byte    UnknownByte;      //generally zero\n  byte    aFlag;            // zero or one\n  bytes   Zeroes[7];\n }[Number of false UseDefault's];\n```\n\nA face data struct only exists for those lods who's UseDefault is zero"},{"heading":"ODOLv4xLod","level":4,"markdown":"```\n ODOLv4xLod\n {\n   ulong                         nProxies;\n   LodProxy                      LodProxies[nProxies];              // see P3D Lod Proxies\n   ulong                         nLodItems;\n   ulong                         LodItems[nLodItems];               // potentially compressed, except for v64 and later\n   ulong                         nBoneLinks;\n   LodBoneLink                   LodBoneLinks[nBoneLinks];\n   float                         UnknownFloat1;\n   float                         UnknownFloat2;\n   XYZTriplet                    MinPos;\n   XYZTriplet                    MaxPos;\n   XYZTriplet                    AutoCenterPos;\n   float                         Sphere;                            // same as geo or mem values in modelinfo, if this lod is geo or memlod of course\n   ulong                         NoOfTextures;\n   asciiz                        LodPaaTextureNames[NoOfTextures];  //\"ca\\characters\\hhl\\hhl_01_co.paa\"\n   ulong                         NoOfMaterials;\n   LodMaterial                   LodMaterials[NoOfMaterials];\n   LodEdges                      LodEdges;                          // compressed see P3D Lod Edges\n   ulong                         NoOfFaces;\n   ulong                         OffsetToSectionsStruct;            // see below\n   ushort                        AlwaysZero;\n   LodFace                       LodFace[NoOfFaces];                // see P3D Lod Faces\n   ulong                         nSections;\n   LodSection                    LodSections[nSections];            // see P3D Lod Sections\n   ulong                         nNamedSelections;\n   LodNamedSelection             LodNamedSelections[nNamedSelections]; //See P3D Named Selections potentially compressed\n   ulong                         nTokens;\n   NamedProperty                 NamedProperties[nTokens];          //See Named Properties\n   ulong                         nFrames;\n   LodFrame                      LodFrames[nFrames];                //see P3D Lod Frames\n   ulong                         IconColor;\n   ulong                         SelectedColor;\n   ulong                         special; // IsAlpha|IsTransparent|IsAnimated|OnSurface\n   byte                          vertexBoneRefIsSimple;\n   ulong                         sizeOfVertexTable;                 //(including these 4 bytes)\n   if (v5x)\n   LodPointFlags                 LodPointFlags;                     // Potentially compressed\n   endif\n   VertexTable                   VertexTable;\n }\n```"},{"heading":"VertexTable","level":5,"markdown":"all arrays are subject to compression\n\n```\nstruct\n{\n   UvSet                         DefaultUVset;\n   ulong                         nUVs;\n   UvSet                         UVSets[nUVs-1];\n   ulong                         NoOfPoints;\n   XYZTriplet                    LodPoints[NoOfPoints];\n   ulong                         nNormals;\n   ulong                         nMinMax;\n   ulong                         nProperties;\n   VertProperty                  VertProperties[nProperties];       //optional related to skeleton\n   ulong                         Count;\n   VertexNeighborInfo            neighborBoneRef[Count];          //optional\n}\n```\n\n- All non zero counts counts are the same.\n- Points,PointFlags, Normals and UV1 arrays are an integral group, they are either all there, or not specified (RacetK.p3d, a FrameTime lod has no counts at all)\n- UV2,MinMax, VertProperties and Unknown are optional in the sense that their counts can individually be zero, else they are the same as the others\n- In Odol7 PointFlags are part of this stucture, in Arma, they are a separated table."},{"heading":"CompressedFill Arrays","level":5,"markdown":"LodPointFlags, LodUV's and LodNormals arrays are not only subject to the standard 1024 rule compression, but also have a fill byte.\n\n```\nstruct\n{\n ulong                         Count;\n tbool                         DefaultFill;\n if (DefaultFill)\n  type                         Array;          // default fill for all Counts\n else\n  type                         Array[Count];   // potentially compressed\n}\n```\n\nThe structure either contains a single set of type variables, or, an array of type variables. If a full array is declared (DefaultFill =false) then that array is subject to the 1024 rule as per normal."},{"heading":"UVset","level":5,"markdown":"```\nLodUV                     LodUV;\n```"},{"heading":"LodUV","level":5,"markdown":"```\nCompressedFill type = UVPair // eg float U,V;\n```"},{"heading":"LodNormals","level":5,"markdown":"```\n CompressedFill type = XYZTriplet\n```"},{"heading":"CompressedXYZTriplet","level":6,"markdown":"contains 3x 10 bit fields in a 32bit 'integer'\n\ncode for converting back to a standard XYZTriplet is:\n\n```\nvoid DecodeXYZ(ulong CompressedXYZ, XYZTriplet *triplet)\n{\n   double scaleFactor = -1.0 / 511;\n   trp->X=trp->Y=trp->Z=0.0;\n   int x=   CompressedXYZ       & 0x3FF;\n   int y = (CompressedXYZ>> 10) & 0x3FF;\n   int z = (CompressedXYZ>> 20) & 0x3FF;\n   if (x > 511) x -= 1024;\n   if (y > 511) y -= 1024;\n   if (z > 511) z -= 1024;\n   if (x) trp->X = (float)(x * scaleFactor);\n   if (y) trp->Y = (float)(y * scaleFactor);\n   if (x) trp->Z = (float)(z * scaleFactor);\n}\n```"},{"heading":"LodPointFlags","level":5,"markdown":"```\nCompressedFill type = ulong bits\n```\n\nThis table is the equivalent of Oxygen's points->properties dialog box. It specifically stores the user values and other flags for that point.\n\nIn ODOl7 it was part of the vertex table. In ArmA, it is separate.\n\nSee P3D Point and Face Flags"},{"heading":"LodMinMax","level":5,"markdown":"```\nCompressedArray\n{\n XYZTriplet     MinMax[Count][2]; // 2 == min vs max\n}\n```"},{"heading":"VertProperty","level":5,"markdown":"```\nCompressedArray\n{\n ulong  index;// seen range 0..4\n ulong  a,b; // definite not floats. might be flags, or indices\n}\n```"},{"heading":"VertexNeighborInfo","level":5,"markdown":"```\nCompressedArray\n{\n ushort  vertexIndex _posA;\n AnimationRTWeight _rtwA;\n ushort  vertexIndex _posB;\n AnimationRTWeight _rtwB;\n}\n```"},{"heading":"LodBoneLink","level":5,"markdown":"```\nLodBoneLink\n{\n  ulong NoOfLinks;         //range 0..3\n  ulong Value[NoOfLinks];  //the 'Value' seems to reference the 'LodItems' structure, resulting in a circular-reference.\n}\n```"},{"heading":"LodMaterials","level":5,"markdown":"Basically... A direct replication of the information in the given .rvmat file\n\nThe stages in the p3d include a default stage and a TI stage that are not normally listed in the rvmat.\n\nThe first stage (in the p3d) is unconditionally the default stage. It is defaulted to empty (RvMatName=\"\"), unless, specified in the rvmat\n\nThe last stage is the TI stage, and is also defaulted empty, unless specified in the rvmat.\n\nTI Stages were introduced for operation arrowhead. Lod Material Types 9 and 10 do not have a TI stage at all.\n\nNeither of these two special, hidden, stage types use uvsets. The transform matrix for them is defaulted empty (so-called 'TexGen0').\n\nWhen specified in the rvmat (class Stage0 and StageTI respectively), no class uvTransform is declared for them. It is assumed default empty.\n\nIn an rvmat, uvTransforms are ordinarily declared within each stage body.\n\nIn a P3D, identical UVTransforms are declared once, and multiple 'stages' refer to them. There is, always, a default UVSet0 Transform as the 1st entry. (IE some stages dont require uvsets)\n\nThis P3D style can, if preferred, be used in rvmat syntax as\n\n```\nclass TexGenX\n{\n  .......\n};\n```\n\n```\nclass StageZ\n{\n  .........\n  Texgen=X;\n};\n```\n\nwhere X and Z are numbers"},{"heading":"LodMaterial","level":5,"markdown":"```\n LodMaterial\n {\n   asciiz            RvMatName;     // \"ca\\characters\\data\\soldier_captive_hhl.rvmat\"\n   ulong             Type;          // 9 == ArmA\n   D3DCOLORVALUE     Emissive;\n   D3DCOLORVALUE     Ambient;\n   D3DCOLORVALUE     Diffuse;\n   D3DCOLORVALUE     forcedDiffuse;\n   D3DCOLORVALUE     Specular;\n   D3DCOLORVALUE     Specular2;       //Usually same as Specular\n   float             SpecularPower;   //\n   ulong            PixelShaderId;   //See enumPixelShaderId\n   ulong            VertexShaderId;  //See enumVertexShaderId\n   LongBool          mainLight;     // 1 or zero\n   ulong             ul_FogMode;    /// 0..4\n   Asciiz            BiSurfaceName;   // \"ca\\data\\Penetration\\plastic.bisurf\"\n   LongBool          Arma1Mostly1;    //rarely zero\n   ulong             RenderFlags;     //Generally 0\n   ulong             nTextures;\n   ulong             nTransforms;     // always same as nTextures\n   LodStageTexture   StageTextures  [nTextures];\n   LodStageTransform StageTransforms[nTransforms];\n }\n```\n\nEach lodmaterial entry contains a default StageTexture and StageTransform as the first entry. It is not shown in the rvmat file and has no PaaTexture\nIt is the only entry if a SurfaceName exists."},{"heading":"D3DCOLORVALUE","level":4,"markdown":"```\nD3DCOLORVALUE\n{\n  float r,g,b,a;\n}\n```"},{"heading":"RenderFlags","level":6,"markdown":"- Bit0:AlwaysInShadow (A1 only)\n- Bit1:NoZWrite\n- Bit4:NoColorWrite\n- Bit5:NoAlphaWrite\n- Bit6:AddBlend\n- Bit7:AlphaTest (clutter)\n- Bit8:AlphaTest64 (clutter)\n- Bit19:Road (a1only)\n- Bit11:NoTiWrite"},{"heading":"LodStageTexture","level":6,"markdown":"```\nLodStageTexture\n{\n ulong  TextureFilter; // see below\n asciiz PaaTexture;    // \"ca\\characters\\data\\civil_tvreport_body_as.paa\n                       // alternatively \"#(argb,8,8,3)color(0,0,0,1,CO)\" (eg)\n ulong  TransformIndex;       // zero based, see below\n};\n```\n\nThe first stageTexture is a dummy entry. For N humanly readable stage classes, there are 1+N LodStageTextures\n\nTextureFilter maybe 1 of the following values.\n\n- 0: Point // sometimes\n- 1: Linear // rarely\n- 2: TriLinear // not seen\n- 3: Anisotropic (default)"},{"heading":"LodStageTransform","level":6,"markdown":"```\n  LodStageTransform\n  {\n   ulong UVSource;\n   float Transform[4][3];//a DirectX texture space transform matrix\n  };\n```\n\nUVSource corresponds to the 8 possible uvsets available\n\n- 0 \"None\"\n- 1 \"Tex\" default\n- 2: \"Tex2\"\n- ........\n- 8:\"Tex8\"\n\n- Tex1..8 cannot be taken literally as uvsource 1..8. They can mean anything, according to the template and are scarcely encountered"},{"heading":"NamedProperty","level":5,"markdown":"```\n struct\n {\n    Asciiz Property;// \"noshadow\" = \"1\" eg\n    Asciiz Value;\n }\n```\n\n- See Named Properties"},{"heading":"Decompression","level":3,"markdown":"see Compressed LZSS File Format\n\nsee Compressed LZO File Format\n\nIn ODOL v40 format files, some of the data structures present in the file are compressed by using LZSS compression.\n\nUnlike pbo compression, in ArmA model files, one only knows the number of items to decompress, the expected output size (in bytes) and the expected checksum.\nWith this information and the size of a given data item one has the necessary information to expand the data to it is original format and size.\n\n> [!NOTE]\n> Data structures that are identified as being compressible will only be compressed if the 'expectedSize' is ≥ 1024 bytes."},{"heading":"Reference Tables","level":3,"markdown":""},{"heading":"Material Stages","level":4,"markdown":"The number of material stages is dependant on the type of Shader that is used to process the material by the ArmA game engine.\nA reference table is used when processing materials where depending on the shader specified the given number of stages should be processed.\n\n```\n refShaderStages\n {\n   int PixelShaderId;\n   int NoOfStages;\n };\n```\n\n| ID (Hex/Decimal) | Name | Description | NoOfStages |\n|---|---|---|---|\n| 0x00, 0 | Normal | diffuse color modulate, alpha replicate | 0 |\n| 0x01, 1 | NormalDXTA | diffuse color modulate, alpha replicate, DXT alpha correction | 0 |\n| 0x02, 2 | NormalMap | normal map shader | 3 |\n| 0x03, 3 | NormalMapThrough | normal map shader - through lighting | 3 |\n| 0x04, 4 | NormalMapSpecularDIMap | VBS2 only | 2 |\n| 0x05, 5 | NormalMapDiffuse | ? | 2 |\n| 0x06, 6 | Detail | ? | 1 |\n| 0x07, 7 | ? | ? | ? |\n| 0x08, 8 | Water | A1 only sea water | 2 |\n| 0x09, 9 | ? | vbs2 | ? |\n| 0x0A, 10 | White | A1 only | 0 |\n| 0x0B, 11 | ? | vbs2 | ? |\n| 0x0C, 12 | AlphaShadow | shadow alpha write | 0 |\n| 0x0D, 13 | AlphaNoShadow | shadow alpha (no shadow) write | 0 |\n| 0x0E, 14 | ? | vbs2 | ? |\n| 0x0F, 15 | DetailMacroAS | ? | 3 |\n| 0x10, 16 | ? | vbs2 | ? |\n| 0x11, 17 | ? | vbs2 | ? |\n| 0x12, 18 | NormalMapSpecularMap | ? | 2 |\n| 0x13, 19 | NormalMapDetailSpecularMap | Similar to NormalMapDiffuse | 3 |\n| 0x14, 20 | NormalMapMacroASSpecularMap | ? | 4 |\n| 0x15, 21 | NormalMapDetailMacroASSpecularMap | ? | 5 |\n| 0x16, 22 | NormalMapSpecularDIMap | Same as NormalMapSpecularMap, but uses _SMDI texture | 2 |\n| 0x17, 23 | NormalMapDetailSpecularDIMap | ? | 3 |\n| 0x18, 24 | NormalMapMacroASSpecularDIMap | ? | 4 |\n| 0x19, 25 | NormalMapDetailMacroASSpecularDIMap | ? | 5 |\n| 0x38, 56 | Glass | ? | 2 |\n| 0x3A, 58 | NormalMapSpecularThrough | ? | 3 |\n| 0x3B, 59 | Grass | Special shader to allow volumetric shadows to be cast on grass clutter | 0 |\n| 0x3C, 60 | NormalMapThroughSimple | ? | 0 |\n| 0xxx, 102 | Super | Arrowhead | 0 |\n| 0xxx, 103 | Multi | Arrowhead | 0 |\n| 0xxx, 107 | Tree | Arrowhead | 0 |\n| 0xxx, 110 | Skin | Arrowhead | 0 |\n| 0x6F, 111 | CalmWater | Arrowhead | 7 |\n| 0xxx, 114 | TreeAdv | Arrowhead | 0 |\n| 0xxx, 116 | TreeAdvTrunk | Arrowhead | 0 |"},{"heading":"Enums","level":3,"markdown":"```\n int enum VertexShaderId\n {\n    case 0: return \"Basic\";\n    case 1: return \"NormalMap\";\n    case 2: return \"NormalMapDiffuse\";\n    case 3: return \"Grass\";\n    case 8: return \"Water\";\n    case 11: return  \"NormalMapThrough\";\n    case 15: return \"NormalMapAS\";\n    case 14: return \"BasicAS\";\n    case 17: return \"Glass\";\n    case 18: return \"NormalMapSpecularThrough\";\n    case 19: return \"NormalMapThroughNoFade\";\n    case 20: return \"NormalMapSpecularThroughNoFade\";\n    case 23: return \"Super\";\n    case 24: return \"Multi\";\n    case 25: return \"Tree\";\n    case 30: return \"CalmWater\";\n    case 26: return \"TreeNoFade\";\n    case 29: return \"Skin\";\n    case 31: return \"TreeAdv\";\n    case 32: return \"TreeAdvTrunk\";\n }\n```"},{"heading":"Links","level":3,"markdown":"Article Author - Sy (Synide) -- Sy 17:16, 11 August 2007 (CEST)\n\nOriginal ODOLv40 Article detailed by Bxbx (Biki'd by Mikero)"}],"categories":["ArmA: Armed Assault: File Formats","Real Virtuality File Formats"],"groups":["Tools and File Formats"]}