Skip to content
Alexander edited this page Jun 2, 2024 · 5 revisions

sections/model/ | model_to_gltf.py | obj_writer.py

Summary

Stores different model data, such as submeshes, LODs, geometry, skeleton, shapekeys, references to materials, etc.

Asset Browser has a preview, but due to materials it's unlikely to ever be very close to in-game visuals.

Asset Browser model viewer

Not all of the sections are researched, and some are not researched enough. Because of that, "converters" from usual 3D formats to .model don't actually make a new one from scratch, and instead inject the data into original .model. For simplicity, and to be sure we don't end up with corrupted asset, we don't change the size of original .model's sections (so offsets and numbers of things, like vertexes, stay correct in those sections we don't know how to tweak). This means we can't inject more than existing number of vertexes, indexes, weights, etc.

Data State
Geometry Researched good enough. Normals (un)packing used to cause problems.
Skeleton Can be exported. Importing is not implemented.
Weights Can be exported and injected. >256 bones is not supported.
Shapekeys Can be exported, but not always look correct. More research needed.
Magic Description
98906B9F MSMR
DB40514C MM
9D2C0FA9 RCRA
CC9DAFF8 -

Sections

General
$\color{#83D038}{◆}$ Model Built
$\color{#250BB8}{◆}$ Model Material
$\color{#8D9CBD}{◆}$ Model Subset
$\color{#6EB7EF}{◆}$ Model Look
$\color{#11902D}{◆}$ Model Look Built

Geometry
$\color{#859863}{◆}$ Model Index
$\color{#98BE69}{◆}$ Model Std Vert
$\color{#B855EE}{◆}$ Model UV1 Vert
$\color{#CBA9DE}{◆}$ Model Col Vert

Skeleton
$\color{#E31971}{◆}$ Model Joint Lookup
$\color{#5DF9D3}{◆}$ Model Joint
$\color{#CC88A1}{◆}$ DCC88A19

Weights
$\color{#61B1FF}{◆}$ Model Skin Batch
$\color{#CA379A}{◆}$ Model Skin Data
$\color{#CBAFF1}{◆}$ CCBAFF15

Shapekeys
$\color{#80A574}{◆}$ Model Anim Morph Info
$\color{#E70957}{◆}$ Model Anim Morph Data
$\color{#600C10}{◆}$ Model Anim Morph Indices

Misc
$\color{#31CBC2}{◆}$ Model Locator Lookup
$\color{#F614FA}{◆}$ Model Locator
$\color{#FD92E6}{◆}$ Model Physics Data
Not researched


General


$\color{#83D038}{◆}$ 283D0383: Model Built

ModelBuiltSection

Contains bunch of general information for the model: offsets, scales, LOD distances, etc. Not researched enough.


$\color{#250BB8}{◆}$ 3250BB80: Model Material

ModelMaterialSection

Array of materials. 32 bytes per material. Contains 64-bit offsets to names in strings block (material slot name and asset filename), 64-bit asset id, CRC32 of slot name and an unknown 32-bit value.


$\color{#8D9CBD}{◆}$ 78D9CBDE: Model Subset

MeshesSection

Array of mesh definition structs. Each is 64 bytes long, and order/size of fields is different between SO and later games.

Contains data such as number of vertexes and indexes for this submesh, index of corresponding material, some flags, "skin batches" number (where vertex weights are stored).


$\color{#6EB7EF}{◆}$ 06EB7EFC: Model Look

ModelLookSection

Array of looks. Each look has 8 LODs (4 in case of SO), each LOD is defined by two 16-bit integers: starting submesh and number of submeshes.

In injecting scripts, like gltf_to_model.py, all LODs typically being overwriten to be equal to LOD0.


$\color{#11902D}{◆}$ 811902D7: Model Look Built

ModelLookBuiltSection

Not researched enough. Contains array of 80 bytes long entries, describing looks, and some other buffer. Each look has 32-bit offset to its name in strings block, as well as two CRC32 of it, and real number of LODs (out of 8 written in $\color{#6EB7EF}{◆}$ Model Look; unexisting LODs typically set to (0, 0)).



Geometry


$\color{#859863}{◆}$ 0859863D: Model Index

IndexesSection

Indexes buffer. Could be (MSMR/MM) delta-encoded.


$\color{#98BE69}{◆}$ A98BE69B: Model Std Vert

VertexesSection

Vertexes' XYZ, UV and normals data. Could be (MSMR/MM) in 7 separate buffers, where every value is xored with all previous (allowing continuous spans of 0s to happen, so it compresses better).


$\color{#B855EE}{◆}$ 6B855EED: Model UV1 Vert

x6B855EED_Section

Second layer of UVs?


$\color{#CBA9DE}{◆}$ 5CBA9DE9: Model Col Vert

ColorsSection

Vertexes' colors. 4 bytes (RGBA?) per vertex.



Skeleton


$\color{#E31971}{◆}$ EE31971C: Model Joint Lookup

JointsMapSection

Map<uint32, uint32>, stored as array of key-value pairs.


$\color{#5DF9D3}{◆}$ 15DF9D3B: Model Joint

JointsSection

Array of joints definitions. Each definition is 16 bytes long.


$\color{#CC88A1}{◆}$ DCC88A19

xDCC88A19_Section

Arrays of joints transforms. One array contains position, rotation and scale, and another stores 4x4 matrixes — both per joint, in the same order as $\color{#5DF9D3}{◆}$ 15DF9D3B.



Weights


$\color{#61B1FF}{◆}$ C61B1FF5: Model Skin Batch

ModelSkinBatchSection

Array of structs describing skin batches. Each is 16 bytes long, contains offset for $\color{#CA379A}{◆}$ Model Skin Data buffer, number of vertexes in a batch and index of first vertex this batch corresponds to.


$\color{#CA379A}{◆}$ DCA379A2: Model Skin Data

Vertexes' weights data buffer, which is to be unpacked according to $\color{#61B1FF}{◆}$ Model Skin Batch.

See get_skin() from 'model_to_gltf.py'.


$\color{#CBAFF1}{◆}$ CCBAFF15

xCCBAFF15_Section

Array of vertexes' weights. Section first met in RCRA. Stores up to 4 weights per vertex, as 8 bytes: 4 joints indexes, 4 weights.

See get_skin() from 'model_to_gltf.py'.

Format might be different for models with more than 256 bones?



Shapekeys


$\color{#80A574}{◆}$ 380A5744: Model Anim Morph Info

ModelAnimMorphInfoSection

Contains arrays of shapekeys headers. Header is of variable size, determined by number of subsets corresponding to a key. Contains information about key's name, weights packing, offsets, etc.


$\color{#E70957}{◆}$ 5E709570: Model Anim Morph Data

Shapekeys positions/normals data buffer, which is to be unpacked according to $\color{#80A574}{◆}$ Model Anim Morph Info.

See add_shapekey() from 'model_to_gltf.py'.


$\color{#600C10}{◆}$ A600C108: Model Anim Morph Indices

ModelAnimMorphIndicesSection

Shapekeys positions/normals indexes buffer, which is to be unpacked according to $\color{#80A574}{◆}$ Model Anim Morph Info. Maps elements unpacked from $\color{#E70957}{◆}$ Model Anim Morph Data to actual vertexes order.

See add_shapekey() from 'model_to_gltf.py'.



Misc


$\color{#31CBC2}{◆}$ 731CBC2E: Model Locator Lookup

LocatorsMapSection

Map<uint32, uint32>, stored as array of key-value pairs.


$\color{#F614FA}{◆}$ 9F614FAB: Model Locator

LocatorsSection

Array of locator definitions. Each definition is 64 bytes long. Contains 32-bit hash of name, 32-bit offset to name in strings block, joint index and 3x4 float matrix.


$\color{#FD92E6}{◆}$ EFD92E68: Model Physics Data

HavokSection

Havok data.


Not researched

Tag Code Name
$\color{#082378}{◆}$ 00823787 x00823787_Section -
$\color{#4D8B13}{◆}$ 14D8B13C x14D8B13C_Section -
$\color{#7CA524}{◆}$ 27CA5246 x27CA5246_Section -
$\color{#C9DABD}{◆}$ 3C9DABDF ModelSplineSubsetsSection Model Spline Subsets
$\color{#A39FAB}{◆}$ 5A39FAB7 x5A39FAB7_Section -
$\color{#240C82}{◆}$ 5240C82B x5240C82B_Section Model Skin Joint Remap
$\color{#CE86B0}{◆}$ BCE86B01 xBCE86B01_Section -
$\color{#D5CF54}{◆}$ 5D5CF541 x5D5CF541_Section -
$\color{#55275D}{◆}$ 855275D7 x855275D7_Section -
$\color{#A84E4D}{◆}$ 8A84E4D6 x8A84E4D6_Section -
$\color{#DD1CBD}{◆}$ ADD1CBD3 xADD1CBD3_Section -
$\color{#25B316}{◆}$ B25B3163 xB25B3163_Section -
$\color{#D90331}{◆}$ CD903318 xCD903318_Section -
$\color{#B7303D}{◆}$ BB7303D5 xBB7303D5_Section -
$\color{#44E582}{◆}$ 244E5823 x244E5823_Section -
$\color{#2349A1}{◆}$ 42349A17 x42349A17_Section -
$\color{#65DA36}{◆}$ 665DA362 x665DA362_Section -
$\color{#CA37DA}{◆}$ 7CA37DA0 AmbientShadowPrimsSection Ambient Shadow Prims
$\color{#AD3A70}{◆}$ 0AD3A708 x0AD3A708_Section -
$\color{#07F1B5}{◆}$ 707F1B58 x707F1B58_Section -
$\color{#CCEA4A}{◆}$ 4CCEA4AD x4CCEA4AD_Section -
Joints-related
$\color{#7380E8}{◆}$ B7380E8C xB7380E8C_Section -
$\color{#5354B6}{◆}$ C5354B60 xC5354B60_Section Model Mirror Ids
$\color{#0CDB60}{◆}$ 90CDB60C x90CDB60C_Section -
Locators-related
$\color{#A434B2}{◆}$ 9A434B29 LocatorRelatedSection -
Looks-related
$\color{#F9FDF1}{◆}$ DF9FDF12 xDF9FDF12_Section -

Home

Assets Browser
Scripts
Code Insights

Knowledge Base
    Glossary
    Other Works

    Files
        toc
        dag

    Formats
        DAT1
        DSAR
        DDL

    Assets
        Assets Reports
        Types
            .actor
            .animclip
            .animset
            .atmosphere
            .cinematic2
            .conduit
            .config
            .level
            .levellight
            .localization
            .material
            .model
            .nodegraph
            .soundbank
            .texture
            .visualeffect
            .wwiselookup
            .zone
            .zonelightbin

    Games

Clone this wiki locally