Members mrmaller1905 Posted Wednesday at 04:42 PM Members Posted Wednesday at 04:42 PM What is *.crp from Need for Speed: Porsche Unleashed and can you start a new Blender import script or plugin to import CRPs? Only ZModeler can import CRPs but doesn't support map models. These files have LZ77 compression. Samples: https://mega.nz/file/MbgFnYbT#SUOSbtu7Mfdw_-HEs3TsF7us3Pfh_yvT-bLkw5LYp6Y Here is the file format specification for CRPs: ================================ CRP 3D Mesh and Textures (*.CRP) ================================ The files are compressed using a LZ77 algorithm style algorithm. The following format is based on the decompressed data. 1) The .CRP file starts with following 16-byte header: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x0000 0x0004 CHAR[4] Identifier (cars: ' raC'/'Car '; tracks: 'karT'/'Trak') 0x0004 0x0004 HeaderInfo Header info 0x0008 0x0004 LONGINT Number of MiscData following table of Articles 0x000C 0x0004 LONGINT Offset Table of Articles (* 16) ------------------------------------------------------------------------------- 0x0010 - size of header ------------------------------------------------------------------------------- HeaderInfo: 5 bits: unknown (always seems to be 0x1A) 27 bits: number of parts (Articles in this case) 2) Data in CRP file from end of header = 0x0010 2a) Table of Articles Offset : Header Size Length : Number of Articles * 16 Type : Article[] Article structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 LONGINT Identifier ('itrA'/'Arti') 0x04 0x04 HeaderInfo Header info 0x08 0x04 LONGINT Length of Parttable pointed to (* 16) 0x0C 0x04 LONGINT Offset (Relative from current Article offset * 16) ------------------------------------------------------------------------------- 0x0010 - size of Article ------------------------------------------------------------------------------- Each Article points to a PartTable. 2b) Table of MiscPart Offset : Header Size + Table of Articles Length Length : Number of Miscdata * Size of Miscdata Type : Miscdata[Number of Miscdata] MiscPart can be MiscData (miscellaneous data) or it can be a MaterialPart or FSHPart. MiscPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 LONGINT Identifier 0x04 0x01 SHORTINT Unknown 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Unknown 0x0C 0x04 LONGINT Offset (Relative from current MiscPart offset) ------------------------------------------------------------------------------- 0x0010 - size of MiscPart ------------------------------------------------------------------------------- MaterialPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 SHORTINT Index 0x02 0x02 CHAR[2] Identifier ('tm'/'mt') 0x04 0x01 SHORTINT Unknown (seems always to be 0xFB) 0x04 0x03 INTEGRAL Length 0x08 0x04 LONGINT Unknown (seems always to be 0x34) 0x0C 0x04 LONGINT Offset (Relative from current MaterialPart offset) ------------------------------------------------------------------------------- 0x0010 - size of MaterialPart ------------------------------------------------------------------------------- FSHPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 SHORTINT Index 0x02 0x02 CHAR[2] Identifier ('fs'/'sf') 0x04 0x01 SHORTINT Unknown (seems always to be 0xFB) 0x04 0x03 INTEGRAL Length 0x08 0x04 LONGINT Number of FSH files (seems always to be 0x01) 0x0C 0x04 LONGINT Offset (Relative from current FSHPart offset) ------------------------------------------------------------------------------- 0x0010 - size of FSHPart ------------------------------------------------------------------------------- Each FSHPart points to an FSH file. 2c) Table of PartTables Offset : Header Size + Table of Articles Length + Table of MiscData Length Length : Unknown Type : Parttable[] PartTable structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 LEN Part[N] Table of Parts ------------------------------------------------------------------------------- Length in Article - size of PartTable ------------------------------------------------------------------------------- LEN = N * 0x10 All Parts are 0x10 long. Possible Part structures: BasePart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 CHAR[4] Identifier ('esaB'/'Base') 0x04 0x01 SHORTINT Unknown (seems always to be 0xEA) 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Unknown (seems always to be 0x00000000) 0x0C 0x04 LONGINT Offset (Relative from current BasePart offset) ------------------------------------------------------------------------------- 0x0010 - size of BasePart ------------------------------------------------------------------------------- NamePart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 CHAR[4] Identifier ('emaN'/'Name') 0x04 0x01 SHORTINT Unknown (seems always to be 0xFA) 0x05 0x03 INTEGRAL Length of text 0x08 0x04 LONGINT Unknown (seems always to be 0x00000000) 0x0C 0x04 LONGINT Offset (Relative from current NamePart offset) ------------------------------------------------------------------------------- 0x0010 - size of NamePart ------------------------------------------------------------------------------- Each NamePart points to a zero-terminated string. CullingPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 Info1 Part info of type 1 0x02 0x04 CHAR[2] Identifier ('n$'/'$n') 0x04 0x01 SHORTINT Unknown 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Number of Culling 0x0C 0x04 LONGINT Offset (Relative from current CullingPart offset) ------------------------------------------------------------------------------- 0x0010 - size of CullingPart ------------------------------------------------------------------------------- TransformationPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 Info1 Part info of type 1 0x02 0x02 CHAR[2] Identifier ('rt'/'tr') 0x04 0x01 SHORTINT Unknown 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Number of Transformation Matrices (always 1) 0x0C 0x04 LONGINT Offset (Relative from current TransformationPart offset) ------------------------------------------------------------------------------- 0x0010 - size of TransformationPart ------------------------------------------------------------------------------- VertexPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 Info1 Part info of type 1 0x02 0x02 CHAR[2] Identifier ('tv'/'vt') 0x04 0x01 SHORTINT Unknown 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Number of Vertices 0x0C 0x04 LONGINT Offset (Relative from current VertexPart offset) ------------------------------------------------------------------------------- 0x0010 - size of VertexPart ------------------------------------------------------------------------------- NormalPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 Info1 Part info of type 1 0x02 0x02 CHAR[2] Identifier ('mn'/'nm') 0x04 0x01 SHORTINT Unknown 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Number of Normals 0x0C 0x04 LONGINT Offset (Relative from current NormalPart offset) ------------------------------------------------------------------------------- 0x0010 - size of NormalPart ------------------------------------------------------------------------------- UVPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 Info1 Part info of type 1 0x02 0x02 CHAR[2] Identifier ('vu'/'uv') 0x04 0x01 SHORTINT Unknown 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Number of UV 0x0C 0x04 LONGINT Offset (Relative from current UVPart offset) ------------------------------------------------------------------------------- 0x0010 - size of UVPart ------------------------------------------------------------------------------- TrianglePart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 Info2 Part info of type 2 0x02 0x02 CHAR[2] Identifier ('rp'/'pr') 0x04 0x01 SHORTINT Unknown 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Number of Indices 0x0C 0x04 LONGINT Offset (Relative from current TrianglePart offset) ------------------------------------------------------------------------------- 0x0010 - size of TrianglePart ------------------------------------------------------------------------------- EffectPart structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 Info1 Part info of type 1 0x02 0x02 CHAR[2] Identifier ('fe'/'ef') 0x04 0x01 SHORTINT Unknown 0x05 0x03 INTEGRAL Length 0x08 0x04 LONGINT Number of Effects (always 1) 0x0C 0x04 LONGINT Offset (Relative from current EffectPart offset) ------------------------------------------------------------------------------- 0x0010 - size of EffectPart ------------------------------------------------------------------------------- Part info structures: Info1: 4 bits: Level of detail 8 bits: Animation index 4 bits: Damage switch (0x8 means damaged) Info2: 12 bits: Part index 4 bits: Level of detail 2d) Data The raw data which is addressed from the headers. Material structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x10 ???? Unknown 0x10 0x10 CHAR[16] Description 0x20 0x08 ???? Unknown 0x28 0x04 LONGINT Texture page index (see TPG file) 0x2C 0x010C ???? Unknown ------------------------------------------------------------------------------- 0x0138 - size of Material ------------------------------------------------------------------------------- Base structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x0C ???? Unknown 0x0C 0x04 LONGINT Number of Levels 0x10 0x34 ???? Unknown 0x44 0x01 SHORTINT Geometry index 0x45 0x01 SHORTINT Type index (0 = default; other = varation) 0x46 0x02 ???? Unknown 0x48 0x02 ???? Unknown (seems to be unused) 0x4A 0x02 ???? Unknown 0x4C 0x02 ???? Unknown (seems to be 01 00) 0x4E 0x02 LEVIND Level index 0x50 0x14 ???? Unknown 0x64 LEN LEVINF Level masks ------------------------------------------------------------------------------- 0x0064 + LEN - size of Base ------------------------------------------------------------------------------- LEVIND: IL 00 (with I the index: 1 = body; 2 = wheel; 8 = driver) LEN = Number of Levels * 0x0C LEVINF: 01 00 00 00 00 L0 FF LF 0L 00 FF FF (with L the Level) Levels (LEVIND - L): 1 : Model used in garage 2 : Model used in in-car view 3+: Exterior models Levels may be left out. Culling structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 REAL X-coordinate 0x04 0x04 REAL Y-coordinate 0x08 0x04 REAL Z-coordinate 0x0C 0x04 REAL Threshold ------------------------------------------------------------------------------- 0x0010 - size of Culling ------------------------------------------------------------------------------- The coordinates determine the normal of the corresponding triangle. The threshold affects the back-face culling algorithm. Threshold: Positive values: sooner culling Zero value : normal culling Negative values: later culling TransformationMatrix structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x40 Matrix Normal 4D Transformation Matrix ------------------------------------------------------------------------------- 0x0040 - size of TransformationMatrix ------------------------------------------------------------------------------- Vertex structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 REAL X-coordinate 0x04 0x04 REAL Y-coordinate 0x08 0x04 REAL Z-coordinate 0x0C 0x04 REAL Unknown (seems always to be 0x3F800000) ------------------------------------------------------------------------------- 0x0010 - size of Vertex ------------------------------------------------------------------------------- Vertex seems to be a normal homogeneous 3D point. Normal structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 REAL X-coordinate 0x04 0x04 REAL Y-coordinate 0x08 0x04 REAL Z-coordinate 0x0C 0x04 REAL Unknown (seems always to be 0x00000000) ------------------------------------------------------------------------------- 0x0010 - size of Normal ------------------------------------------------------------------------------- Normal seems to be a normal homogeneous 3D vector. UV structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 REAL U-coordinate 0x04 0x04 REAL V-coordinate ------------------------------------------------------------------------------- 0x0008 - size of UV ------------------------------------------------------------------------------- TriangleData structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 ???? Info flags 0x04 0x02 INTEGER Material index 0x06 0x02 ???? Unknown 0x08 0x10 FLOAT[4] Unknown 0x18 0x10 ???? Unknown (always seems to be 0x00000000) 0x28 0x04 LONGINT Number of InfoRows (NIF) 0x2C 0x04 LONGINT Number of IndexRows (NID) 0x30 LENF InfoRow[NIF] Info rows OFFD LEND IndexRow[NID] Index rows ------------------------------------------------------------------------------- 0x30 + LENF + LEND - size of TriangleData header ------------------------------------------------------------------------------- LENF = NIF * 0x10 OFFD = LENF + 0x30 LEND = NID * 0x08 Info flags: 1st byte: D3DFILLMODE (D3DFILL_POINT = 1, D3DFILL_WIREFRAME = 2, D3DFILL_SOLID = 3) Possible InfoRow structures: CullingRow structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 ???? Unknown 0x04 0x04 LONGINT Offset in culling data 0x08 0x02 INTEGER Length of culling data used 0x0A 0x02 CHAR[2] Identifier ('n$') 0x0C 0x02 INTEGER Level index 0x0E 0x02 ???? Unknown (always seems to be 0xFFFF) ------------------------------------------------------------------------------- 0x0010 - size of CullingRow ------------------------------------------------------------------------------- VertexRow structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 ???? Unknown 0x04 0x04 LONGINT Offset in vertex data 0x08 0x02 INTEGER Length of vertex data used 0x0A 0x04 INTEGER Unknown (?ordening?) 0x0C 0x02 INTEGER Level index 0x0E 0x02 ???? Unknown (always seems to be 0x0000) ------------------------------------------------------------------------------- 0x0010 - size of VertexRow ------------------------------------------------------------------------------- NormalRow structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 ???? Unknown 0x04 0x04 LONGINT Offset in normal data 0x08 0x02 INTEGER Length of normal data used 0x0A 0x04 INTEGER Unknown (?ordening?) 0x0C 0x02 INTEGER Level index 0x0E 0x02 ???? Unknown (always seems to be 0x0000) ------------------------------------------------------------------------------- 0x0010 - size of NormalRow ------------------------------------------------------------------------------- UVRow structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 ???? Unknown 0x04 0x04 LONGINT Offset in uv data 0x08 0x02 INTEGER Length of uv data used 0x0A 0x04 INTEGER Unknown (?ordening?) 0x0C 0x02 INTEGER Level index 0x0E 0x02 ???? Unknown (always seems to be 0x0001) ------------------------------------------------------------------------------- 0x0010 - size of UVRow ------------------------------------------------------------------------------- NIF always seems to be 3 or 4: 3: NormalRow, UVRow, VertexRow 4: CullingRow, NormalRow, UVRow, VertexRow Possible IndexRow structures: VertexIndexRow structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 INTEGER Index of VertexIndex 0x02 0x02 CHAR[2] Identifier ('vI' / 'Iv') 0x04 0x04 LONGINT Offset of Vertex indices ------------------------------------------------------------------------------- 0x0008 - size of VertexIndexRow ------------------------------------------------------------------------------- UVIndexRow structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x02 INTEGER Index of UVIndex 0x02 0x02 CHAR[2] Identifier ('uI' / 'Iu') 0x04 0x04 LONGINT Offset of UV indices ------------------------------------------------------------------------------- 0x0008 - size of UVIndexRow ------------------------------------------------------------------------------- If NID is 2 there is a VertexIndexRow and UVIndexRow. The header is followed by NID tables. Each table contains Number of Indices (specified in TrianglePart) SHORTINTs, which are the actual indices. Effect structure: ------------------------------------------------------------------------------- Offset Length Type Description ------------------------------------------------------------------------------- 0x00 0x04 LONGINT Unknown (seems always to be 0x05000000) 0x04 0x04 LONGINT Unknown (seems always to be 0x00000000) 0x08 0x04 REAL X-coordinate 0x0C 0x04 REAL Y-coordinate 0x10 0x04 REAL Z-coordinate 0x14 0x04 REAL Unknown (seems always to be 0x3F800000) 0x18 0x04 REAL X-coordinate width (relative to X-coordinate) 0x1C 0x04 REAL Y-coordinate width (relative to Y-coordinate) 0x20 0x04 REAL Z-coordinate width (relative to Z-coordinate) 0x24 0x04 REAL Unknown (seems always to be 0x00000000) 0x28 0x04 REAL X-coordinate height (relative to X-coordinate) 0x2C 0x04 REAL Y-coordinate height (relative to Y-coordinate) 0x30 0x04 REAL Z-coordinate height (relative to Z-coordinate) 0x34 0x04 REAL Unknown (seems always to be 0x00000000) 0x38 0x04 REAL X-coordinate depth (relative to X-coordinate) 0x3C 0x04 REAL Y-coordinate depth (relative to Y-coordinate) 0x40 0x04 REAL Z-coordinate depth (relative to Z-coordinate) 0x44 0x04 REAL Unknown (seems always to be 0x00000000) 0x48 0x04 Color Color of glow (BGRA format) 0x4C 0x04 Color Color of source (BGRA format) 0x50 0x04 LONGINT Mirror (0x08000000 means mirrored) 0x54 0x04 ???? Information ------------------------------------------------------------------------------- 0x0058 - size of Effect ------------------------------------------------------------------------------- 3) Notes LONGINT : long integer (32-bit) INTEGER : integer (16-bit) SHORTINT: short interger (8-bit) REAL : floating point number (32-bit) nfsporscheunleashed_crpfileformatspec.zip
Engineers shak-otay Posted Wednesday at 09:48 PM Engineers Posted Wednesday at 09:48 PM (edited) 6 hours ago, mrmaller1905 said: The following format is based on the decompressed data. Do you have decompressed files? edit: information required about header of compressed crp files (which starts with 10 FB) Because using a standard LZ77 algo results in a zero byte output. Edited Wednesday at 10:46 PM by shak-otay
Members mrmaller1905 Posted Thursday at 06:29 AM Author Members Posted Thursday at 06:29 AM 8 hours ago, shak-otay said: Do you have decompressed files? edit: information required about header of compressed crp files (which starts with 10 FB) Because using a standard LZ77 algo results in a zero byte output. Sure, here are decompressed CRPs, and here is CRP2DRP which is a very old tool. decompressedcrps.zip crp2drp.zip 1
Engineers shak-otay Posted Thursday at 11:36 AM Engineers Posted Thursday at 11:36 AM Thanks! Here's a point cloud from autobahn. (Other than for cars I couldn't find face indices, on a quick glance.) Since the structures of crp files are known (more or less) there should be apps for tracks already, right?
Members Solution testing4562145 Posted Thursday at 06:09 PM Members Solution Posted Thursday at 06:09 PM i found a bunch of information here 2
Engineers shak-otay Posted Thursday at 07:32 PM Engineers Posted Thursday at 07:32 PM Thanks! Works great (I wasn't in the mood to add textures, though):
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now