OBD:M3GM: Difference between revisions

From OniGalore
Jump to navigation Jump to search
mNo edit summary
(PS2 implementation of M3GM (not yet fully understood))
Line 17: Line 17:
{{OBDtr|0x20|link    |FFFFC8|01 11 01 00|273  | link to [[OBD:IDXA_M3GM_2|00273-.IDXA]] (face groupings) }}
{{OBDtr|0x20|link    |FFFFC8|01 11 01 00|273  | link to [[OBD:IDXA_M3GM_2|00273-.IDXA]] (face groupings) }}
{{OBDtr|0x24|link    |FFFFC8|01 D8 00 00|216  | link to 00216-.[[OBD:TXMP|TXMP]] (texture) }}
{{OBDtr|0x24|link    |FFFFC8|01 D8 00 00|216  | link to 00216-.[[OBD:TXMP|TXMP]] (texture) }}
{{OBDtr|0x28|link    |C8FFC8|00 00 00 00|unused| unused link; never used in Oni}}
{{OBDtr|0x28|link    |C8FFC8|00 00 00 00|unused| obsolete GMAN (geometry animation) link; never used in Oni}}
{{OBDtr|0x2C|char[20]|C8FFFF|AD DE      |dead  | unused}}
{{OBDtr|0x2C|char[20]|C8FFFF|AD DE      |dead  | unused}}
|}
|}
Line 36: Line 36:
;Face groupings
;Face groupings
:The second IDXA groups the triangles into faces (oriented by the second VCRA).
:The second IDXA groups the triangles into faces (oriented by the second VCRA).
;Geometry animation
:Geometry animation worked in a way similar to texture animation, by picking M3GMs from an array (GMAN) and displaying them at a specified frame rate, optionally with randomization.
;PS2 implementation
:PS2 M3GMs have the same data size as PC and Mac ones (0x24 bytes of actual data, 0x2C if counting the instance and level IDs), but the layout is different. Normals aren't stored at all, hence both VCRA and the second IDXA are simply missing. Instead the M3GM explicitly stores the number of vertices, as well as (apparently) the number of unique XYZ coordinates (a.k.a. control points). There is also a mysterious .sep part (not yet documented).
:An an example, consider M3GMaxes of level0_Final (even though it is somewhat broken).
{{Table}}
{{OBDth}}
{{OBDtr|0x00|res_id  |FF0000|01 63 00 00|99    | 00099-axes.M3GM}}
{{OBDtr|0x04|lev_id  |FFFF00|01 00 00 00|0    | level 0}}
{{OBDtr|0x08|int32  |FFC8C8|00 00 00 00|0    | runtime geometry flags (supposedly the same as for PC and Mac) }}
{{OBDtr|0x0C|int32  |FFC8C8|60 00 00 00|96    | number of vertices with unique XYZ coordinates? }}
{{OBDtr|0x10|int32  |FFFFC8|01 64 00 00|100  | link to [[OBD:PNTA|00100-.PNTA]] (vertex XYZs) }}
{{OBDtr|0x14|link    |FFFFC8|01 65 00 00|101  | link to [[OBD:TXCA|00101-.TXCA]] (vertex UVs) }}
{{OBDtr|0x18|link    |FFFFC8|01 66 00 00|240  | link to [[OBD:IDXA_M3GM_1|00268-.IDXA]] (triangle strips) }}
{{OBDtr|0x1C|int32  |FFC8C8|6C 00 00 00|108  | number of vertices (same as in PNTA and TXCA); also size of .raw part? }}
{{OBDtr|0x20|offset  |FFFFC8|A0 8E 01 00| 0x00018EA0 | apparently an offset into the .raw file, purpose unknown (108 first bytes shown in bold)
'''2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D F8 F8 C2 55'''
'''40 40 10 D4 D4 09 C2 5F 6B 6B 6B 6B 6B 6B 6B 6B'''
'''6B 82 82 D9 16 E3 E3 00 EB EB 6D 6D 6D 6D 6D 6D'''
'''6D 6D 6D 6D AB AB EB 80 52 FC 95 30 30 EA EA EA'''
'''EA EA A7 A7 24 EA EA EA EA 24 02 02 02 A7 A7 A7'''
'''A7 EF EA EA EA EA 02 02 02 02 24 24 24 24 F8 2D'''
'''2D 2D 2D A7 A7 A7 A7 EA EA EA EA 16''' 02 02 02 02
Current assumption is that they are color indices, but it is unclear what palette is referenced.
}}
{{OBDtr|0x24|link    |FFFFC8|01 67 00 00|103  | broken texture link (there is no instance 103 (!) and the relevant texture is 00104-_axis.[[OBD:TXMP|TXMP]] }}
{{OBDtr|0x28|link    |C8FFC8|00 00 00 00|unused| supposedly the same GMAN link (geometry animation) as for PC and Mac }}
{{OBDtr|0x2C|char[20]|C8FFFF|AD DE      |dead  | unused}}
|}
Even without a full understanding of the .raw part, the current knowledge is sufficient to extract M3GM data and even to export it to other formats (with missing or autogenerated normals).





Revision as of 15:43, 15 November 2022

ONI BINARY DATA
M3GA << Other file types >> Mtrl
M3GM : Geometry
switch to XML:M3GM page
Overview @ Oni Stuff
OBD.png


M3gm all.gif


Offset Type Raw Hex Value Description
0x00 res_id 01 D7 00 00 215 00215-door_1_0.M3GM
0x04 lev_id 01 00 00 06 3 level 3
0x08 int32 00 00 00 00 0 runtime only
0x0C link 01 DA 00 00 218 link to 00218-.PNTA (vertex XYZs)
0x10 link 01 F7 00 00 247 link to 00247-.VCRA (vertex normals)
0x14 link 01 F0 00 00 240 link to 00240-.VCRA (face normals)
0x18 link 01 ED 00 00 237 link to 00237-.TXCA (vertex UVs)
0x1C link 01 0C 01 00 268 link to 00268-.IDXA (triangle strips)
0x20 link 01 11 01 00 273 link to 00273-.IDXA (face groupings)
0x24 link 01 D8 00 00 216 link to 00216-.TXMP (texture)
0x28 link 00 00 00 00 unused obsolete GMAN (geometry animation) link; never used in Oni
0x2C char[20] AD DE dead unused


Vertices
XYZ and UV coordinates are stored in parallel (same number of entries in PNTA and TXCA).
Vertex normals
The first VCRA stores the normals for every vertex (same entries as in PNTA and TXCA).
Vertex normals are used by Gouraud shading (directional lighting).
Face normals
The second VCRA stores the normals for every face (groups defined by the second IDXA).
Face normals are used for backface culling.
Triangle strips
The first IDXA lists the triangles as strips. The IDs are the ones in PNTA and IDXA.
The start of a new strip is signaled by a high bit in the ID of its first vertex.
Strips are more optimal for rendering, they are generated when authoring an M3GM.
Face groupings
The second IDXA groups the triangles into faces (oriented by the second VCRA).
Geometry animation
Geometry animation worked in a way similar to texture animation, by picking M3GMs from an array (GMAN) and displaying them at a specified frame rate, optionally with randomization.
PS2 implementation
PS2 M3GMs have the same data size as PC and Mac ones (0x24 bytes of actual data, 0x2C if counting the instance and level IDs), but the layout is different. Normals aren't stored at all, hence both VCRA and the second IDXA are simply missing. Instead the M3GM explicitly stores the number of vertices, as well as (apparently) the number of unique XYZ coordinates (a.k.a. control points). There is also a mysterious .sep part (not yet documented).
An an example, consider M3GMaxes of level0_Final (even though it is somewhat broken).
Offset Type Raw Hex Value Description
0x00 res_id 01 63 00 00 99 00099-axes.M3GM
0x04 lev_id 01 00 00 00 0 level 0
0x08 int32 00 00 00 00 0 runtime geometry flags (supposedly the same as for PC and Mac)
0x0C int32 60 00 00 00 96 number of vertices with unique XYZ coordinates?
0x10 int32 01 64 00 00 100 link to 00100-.PNTA (vertex XYZs)
0x14 link 01 65 00 00 101 link to 00101-.TXCA (vertex UVs)
0x18 link 01 66 00 00 240 link to 00268-.IDXA (triangle strips)
0x1C int32 6C 00 00 00 108 number of vertices (same as in PNTA and TXCA); also size of .raw part?
0x20 offset A0 8E 01 00 0x00018EA0 apparently an offset into the .raw file, purpose unknown (108 first bytes shown in bold)
2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D 2D F8 F8 C2 55
40 40 10 D4 D4 09 C2 5F 6B 6B 6B 6B 6B 6B 6B 6B
6B 82 82 D9 16 E3 E3 00 EB EB 6D 6D 6D 6D 6D 6D
6D 6D 6D 6D AB AB EB 80 52 FC 95 30 30 EA EA EA
EA EA A7 A7 24 EA EA EA EA 24 02 02 02 A7 A7 A7
A7 EF EA EA EA EA 02 02 02 02 24 24 24 24 F8 2D
2D 2D 2D A7 A7 A7 A7 EA EA EA EA 16 02 02 02 02

Current assumption is that they are color indices, but it is unclear what palette is referenced.

0x24 link 01 67 00 00 103 broken texture link (there is no instance 103 (!) and the relevant texture is 00104-_axis.TXMP
0x28 link 00 00 00 00 unused supposedly the same GMAN link (geometry animation) as for PC and Mac
0x2C char[20] AD DE dead unused

Even without a full understanding of the .raw part, the current knowledge is sufficient to extract M3GM data and even to export it to other formats (with missing or autogenerated normals).


ONI BINARY DATA
M3GA << Other file types >> Mtrl
M3GM : Geometry
Generic file