MOD file
Revision as of 05:24, 8 March 2024 by GameCubing8619 (talk | contribs)
To do: Cleanup.
The entire MOD file documentation is currently being hosted online on a public MEGA folder containing a lot of information on the Pikmin 1 file formats.MOD files are also known to contain not only the models but also the route and collsion for that map or if it is just a enemy and not a map it would just have the model and collsion
Here is the document details:
MOD files practice 0x20 alignment for chunks and often sub-sections. All Chunk Types ['0x00', '0x10', '0x11', '0x18', '0x20', '0x22', '0x30', '0x40', '0x50', '0x60', '0x100', '0x110', '0xffff', '0x41', '0x13', '0x19', '0x1a', '0x61', '0x12'] Ambrosia speculates that... Chunk 0x0013 is vertex colors Chunk 0x0019 has shadows? Chunk 0x0040 0x0060 has rigging I think that Chunk 0x0060 has rigging ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ ---------------------------------------------------------------------------------------------------- Header Chunk (0x0000) { 0x08 Subheader { 0x04 uint # Opcode (0x00000000) 0x04 uint # Size of Container (Always 0x38) } Container { 0x18 ??? # Padding? 0x02 uint # Year 0x01 uint # Month 0x01 uint # Day 0x04 bitfield { 00000000 00000000 00000000 00000001 # Scaling System ( 0=CLASSIC | 1=SOFTIMAGE ) 00000000 00000000 00000000 00000010 00000000 00000000 00000000 00000100 00000000 00000000 00000000 00001000 # ( 1=Using Vertex NBT ) 00000000 00000000 00000100 00000000 } 0x18 padding } } ---------------------------------------------------------------------------------------------------- Vertexes (0x0010) { 0x08 Subheader { 0x04 uint # Opcode (0x00000010) 0x04 uint # Size of Container } Container { 0x04 uint # Number of Packets (var %10) 0x14 ??? # Padding? 0x0C packet { # Vertex Position 0x04 float # X position 0x04 float # Y position 0x04 float # Z position } [•] Repeated %10 times } } ---------------------------------------------------------------------------------------------------- Vertex Colors (0x0013) { # "COLOR0" 0x08 Subheader { 0x04 int # Opcode (0x00000013) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets (var %13) 0x14 ??? # Padding? 0x04 packet { # Mesh Color Definition 0x01 int # Red 0x01 int # Green 0x01 int # Blue 0x01 int # Alpha (More like threshold?) } [•] Repeated %13 times } } ---------------------------------------------------------------------------------------------------- Vertex Normals (0x0011) { 0x08 Subheader { 0x04 int # Opcode (0x00000011) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets (var %11) 0x14 ??? # Padding? 0x0C packet { # Vertex Normal 0x04 float # X vector 0x04 float # Y vector 0x04 float # Z vector } [•] Repeated %11 times } } ---------------------------------------------------------------------------------------------------- Vertex NBT (0x0012) { 0x08 Subheader { 0x04 int # Opcode (0x00000012) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets (var %12) 0x14 ??? # Padding? 0x24 packet { # 3 sets of vector3fs 0x04 float # Normal 0x04 float # ... 0x04 float # ... 0x04 float # Binormal 0x04 float # ... 0x04 float # ... 0x04 float # Tangent 0x04 float # ... 0x04 float # ... } [•] Repeated %12 times } } ---------------------------------------------------------------------------------------------------- UV Mapping (0x0018) to (0x001F) { 0x08 Subheader { 0x04 int # Opcode (0x00000018) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets? (var %18) 0x14 ??? # Padding? 0x08 packet { # Guessed from size of packet and count (vector2f?) 0x04 float 0x04 float } [•] Repeated %18 times } } ---------------------------------------------------------------------------------------------------- Textures (0x0020) { 0x08 Subheader { 0x04 int # Opcode (0x00000020) 0x04 int # Size of Container } Container { 0x04 int # Number of TXE Files (var %20) 0x14 ??? # Padding? TXE file [•] Repeated %20 times } } ---------------------------------------------------------------------------------------------------- Texture Attributes (0x0022) { 0x08 Subheader { 0x04 int # Opcode (0x00000022) 0x04 int # Size of Container } Container { 0x04 packet # Number of Packets? (var %22) 0x14 ??? # Padding? 0x0C struct { # Single Attribute 0x02 int # Texture Index 0x02 ??? # Probably for pallette 0x01 uint # Wrap_S (0 = repeat, 1 = clamp, ...more?) 0x01 uint # Wrap_T (0 = repeat, 1 = clamp, ...more?) 0x02 uint # ? (1 if max LOD is present?) 0x04 float # Max LOD (distance before mipmap is forced) } [•] Repeated %22 times?? } ) ---------------------------------------------------------------------------------------------------- Material Data (0x0030) { #Note: This chunk has several complexities not well documented currently 0x08 Subheader { 0x04 int # Opcode (0x00000030) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets (var %30) 0x04 int 0x10 ??? # Padding? 0x0c packet { # Mesh Color Definition 0x01 ??? 0x01 ??? # ??? (makes invisible) 0x01 int # Texture Alpha Flag (Appendix #30a) 0x01 int # Texture Application(?) Flag (Appendix #30b) 0x04 ??? 0x04 struct { # RGB mesh color 0x01 int # Red 0x01 int # Green 0x01 int # Blue 0x01 int # Alpha? } } [•] Repeated %30 times } ) Saturation and sharpness?? Chunk is inaccurate ---------------------------------------------------------------------------------------------------- Matrix Envelope (0x0041) { 0x08 Subheader { 0x04 int # Opcode (0x00000041) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets? (var %41a) 0x14 ??? # Padding? 0x?? packet { # Envelope Matrix 0x02 int # Matrix Count (var %41b) 0x?? packet { # Matrix 0x02 int # ID 0x04 float # Weight } [•] Repeated %41b times } [•] Repeated %41a times } } ---------------------------------------------------------------------------------------------------- Matrix (0x0040) { 0x08 Subheader { 0x04 int # Opcode (0x00000040) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets? (var %40) 0x14 ??? # Padding? 0x20 packet { # ??? 0x04 int? 0x1C ??? } [•] Repeated %40 times?? } } ---------------------------------------------------------------------------------------------------- Meshes (0x0050) { 0x08 Subheader { 0x04 int # Opcode (0x00000050) 0x04 int # Size of Container } Container { 0x04 int # Number of Meshes (var %50a) 0x14 # Padding 0x04 int # flags 0x04 int # unk 0x04 int # Number of Matrix Groups (var %50b) ?? Matrix Group { 0x04 int 0x02 int # This doesn't appear to always be here 0x04 int # Number of Display Lists (var %50c) 0x?? Display List { 0x04 int 0x04 int 0x04 int } [•] Repeated %50b times } [•] Repeated %50a times 0x?? # Padding to next multiple of 0x20 Mesh Data { ??? } } } GX_POINTS = 0xb8, GX_LINES = 0xa8, GX_LINESTRIP = 0xb0, GX_TRIANGLES = 0x90, GX_TRIANGLESTRIP = 0x98, GX_TRIANGLEFAN = 0xa0, GX_QUADS = 0x80 0x0030 if > 0x0030 0x0060 0x0041 0x0040 0x0050 0x0100 0x0062 0x0110 else 0x0013 0x0010 0x0000 0x0012 0x0021 0x0020 0x0018 to 0x001F 0x0023 04 chunk opcode 04 chunk size 04 packet count 14 padding 04 unk 04 unk 04 unk_val if (unk_val != 0) { allocate ( unk_val << 4 ) + 8 ) construct_new_array of mtxGroups ( [__ct__8MtxGroupFv] is passed on r3 ) array of mtxGroups[] } mtxGroup 04 unk_val if (unk_val != 0) { allocate ( unk_val << 2 ) array of ???[] 02 unk if that last thing is not 0, something happens 04 disp_list_count if that last thing is 0, abort ---------------------------------------------------------------------------------------------------- Joints (0x0060) { 0x08 Subheader { 0x04 int # Opcode (0x00000060) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets? (var %60) 0x14 ??? # Padding? 0x4C? packet { # ?something? 0x04 sint # Parent index (-1 is null) 0x04 uint # flags 0x18 struct { # Volume 0x04 float # Min X 0x04 float # Min Y 0x04 float # Min Z 0x04 float # Max X 0x04 float # Max Y 0x04 float # Max Z } 0x0C struct { # Scale 0x04 float # X 0x04 float # Y 0x04 float # Z } 0x0C struct { # Rotation 0x04 float # X 0x04 float # Y 0x04 float # Z } 0x0C struct { # Translation 0x04 float # X 0x04 float # Y 0x04 float # Z } } [•] Repeated %60 times. } } ---------------------------------------------------------------------------------------------------- Joint Names (0x0061) { 0x08 Subheader { 0x04 int # Opcode (0x00000061) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets? (var %61a) 0x14 ??? # Padding? 0x?? packet { 0x04 int # Length of string (var %61b) %61b string # "node name" } [•] Repeated %61a times? } } ---------------------------------------------------------------------------------------------------- Something with texname palettes chunk (0x0080) { # Unconfirmed in any MOD files } ---------------------------------------------------------------------------------------------------- Collision Mesh (0x0100) { 0x08 Subheader { 0x04 int # Opcode (0x00000100) 0x04 int # Size of Container } Container { 0x04 int # Number of Packets (var %100a) 0x04 int # ??? (seen being 1 instead of 0) 0x10 ??? # Padding? 0x20 ??? 0x28 packet { 0x04 bitfield { # MapCode 00011000 00000000 00000000 00000000 # SlipCode (Appendix #100) 11100000 00000000 00000000 00000000 # Attribute (Appendix #100) 00000100 00000000 00000000 00000000 # isBald } 0x04 int # Vertex C index (from 0x0010 chunk) 0x04 int # Vertex B index (from 0x0010 chunk) 0x04 int # Vertex A index (from 0x0010 chunk) 0x02 ??? # Padding? 0x02 int # Edge 3 neighbor (FFFF means no neighbor) 0x02 int # Edge 2 neighbor (FFFF means no neighbor) 0x02 int # Edge 1 neighbor (FFFF means no neighbor) 0x04 float # Face Normal X 0x04 float # Face Normal Y 0x04 float # Face Normal Z 0x04 float # Magnitude (Appendix #100) } [•] Repeated %100a times? } } ---------------------------------------------------------------------------------------------------- Collision Groups (0x0110) { Thank you Ambrosia for your help 0x08 Subheader { 0x04 int # Opcode (0x00000110) 0x04 int # Size of Container } Container { 0x18 struct { # MapMgr bounding box 0x04 float # min X 0x04 float # min Y 0x04 float # min Z 0x04 float # max X 0x04 float # max Y 0x04 float # max Y } 0x04 float # Collision Grid Scale (Always 64.0) 0x04 int # Collision Grid width (X) [ ceil( ( |minX| + |maxX| ) / 64.0 ) ] 0x04 int # Collision Grid depth (Z) [ ceil( ( |minX| + |maxX| ) / 64.0 ) ] Coll tris? { 0x?? ints } } } ---------------------------------------------------------------------------------------------------- EOF Chunk (0xFFFF) { # End of MOD. Beginning of INI 0x08 Subheader { 0x04 int # Opcode (0x0000FFFF) 0x04 int # Size of Container } 0x18 Padding } ---------------------------------------------------------------------------------------------------- ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ APPENDIX #30a Each bit of the byte toggles a texture alpha mode. If multiple bytes are toggled, the Least Significant Bit is considered. Inverted Semi-Transparent is an exception to this rule. For it to be active, at least one of the other states must be active at the same time. It itself does not get modified by other states. State Binary Flags Preview Invalid State 00000000 Disabled 00000001 Mode 1 00000010 Mode 2 00000100 Inverted Semi-Transparent 10000XXX #30b This feature has just been documented, so not much is known about it yet. State Binary Flags Preview Invalid State 00000000 Texture applied 00000001 #100 Slipcodes State Binary Flags No slip 00 Slip (weak) 01 Slip (stong) 10 Slip (weak) 11 Attributes State Translation Binary Flags ?? soil 000 ?? stone 001 ?? grass 010 ? wood 011 ???? mud 100 ?? water 101 ?? hole 110 ???????? nothing 111 Note: "hole" and "nothing" are sound identical to "soil". Also, "mud" sounds like sand. The "water" attribute is what causes Pikmin to drown. Calculating the Magnitude 1) Solve for the center of the tri (average the three XYZ positions) 2) If necessary, recalculate the face's normal with a cross factor 3) magnitude = (avg_x * norm_x) + (avg_y * norm_y) + (avg_z * norm_z)
Visit the document here: https://mega.nz/#F!Ek1RmI5R!8xYfk-REVLvFuMjJsOplUg
Credits: Minty_Meeo