XML:M3GM: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(Created page with "{{XML_File_Header | type=AISA | prev=AGQR | next=AITR | name=AI Character Setup Array }} ==General information== * The xml code on this page was tested with onisplit v0.9.86...")
 
m (correcting prev/next types in nav header)
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{XML_File_Header | type=AISA | prev=AGQR | next=AITR | name=AI Character Setup Array }}
{{XML_File_Header | prev=IPge | type=M3GM | next=Mtrl | name=Geometry}}
 


==General information==
==General information==
* The xml code on this page was tested with onisplit v0.9.86.0
* The XML on this page was tested with OniSplit v0.9.86.0, v0.9.94.0 and v0.9.95.0.
* M3GM files local (level''N'') and global (level0).
* M3GM files can be both local (level''N'') and global (level0).
** Most global M3GMs are used by particle.
** Most global M3GMs are used by particles.
** Most local M3GMs are doors or animated objects.
** Most local M3GMs are the models used for doors or animated objects.


 
==File structure==
==M3GM==
{| class="wikitable" width="100%"
!width=200px| XML tag
!width=100px| Content type
! Description
|-
| <M3GM id="...">
| integer
|
|-
|valign=top| <Points>
|valign=top| link
| "#" + instance ID of [[#PNTA|PNTA]].
: XYZ and UV coordinates are stored in parallel (same number of entries in PNTA and TXCA).
|-
|valign=top| <VertexNormals>
|valign=top| link
| "#" + instance ID of [[#VCRA|VCRA]].
: 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).
|-
|valign=top| <FaceNormals>
|valign=top| link
| "#" + instance ID of [[#VCRA|VCRA]].
: The second VCRA stores the normals for every face (groups are defined by the second IDXA).
: Face normals are used for backface culling.
|-
|valign=top| <TextureCoordinates>
|valign=top| link
| "#" + instance ID of [[#TXCA|TXCA]].
: Vertex UVs.
|-
|valign=top| <TriangleStrips>
|valign=top| link
| "#" + instance ID of [[#IDXA|IDXA]].
: 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.
|-
|valign=top| <FaceNormalIndices>
|valign=top| link
| "#" + instance ID of [[#IDXA|IDXA]].
: The second IDXA groups the triangles into faces (oriented by the second VCRA).
|-
| <Texture>
| link
| TXMP''name''
|}


===PNTA===
===PNTA===
{| class="wikitable" width="100%"
!width=200px| XML tag
!width=100px| Content type
! Description
|-
| <PNTA id="...">
| integer
| Instance ID.
|-
| <BoundingBox>
| -
|
|-
| <Min>
| float x3
|
|-
| <Max>
| float x3
|
|-
| <BoundingSphere>
| -
|
|-
| <nowiki><Center></nowiki>
| float x3
|
|-
| <Radius>
| float
|
|-
| <Positions>
| -
| This is an int32 array for the <Vector3> tags.
|-
| <Vector3>
| float x3
| X Y Z coordinate of the point.
|}


===VCRA===
===VCRA===
 
{| class="wikitable" width="100%"
===VCRA===
!width=200px| XML tag
!width=100px| Content type
! Description
|-
| <VCRA id="...">
| integer
| Instance ID.
|-
| <Normals>
| -
| This is an int32 array for the <Vector3> tags.
|-
| <Vector3>
| float x3
| X Y Z coordinate of the normal vector.
|}


===TXCA===
===TXCA===
{| class="wikitable" width="100%"
!width=200px| XML tag
!width=100px| Content type
! Description
|-
| <TXCA id="...">
| integer
| Instance ID.
|-
| <TexCoords>
| -
| This is an int32 array for the <Vector2> tags.
|-
| <Vector2>
| float x2
| X Y coordinates.
|}


===IDXA===
===IDXA===
{| class="wikitable" width="100%"
!width=200px| XML tag
!width=100px| Content type
! Description
|-
| <IDXA id="...">
| integer
| Instance ID.
|-
| <Indices>
| -
| This is an int32 array for the <Int32> tags.
|-
|valign=top| <Int32>
|valign=top| int32
|
; [[OBD:IDXA_M3GM_1|First IDXA]]
: PNTA element ID (used to build triangles with the points of the PNTA instance)
; [[OBD:IDXA_M3GM_2|Second IDXA]]
: VCRA element ID (used to assign the normals to every triangle)
|}
==Export==
===.oni to OBJ/DAE===
onisplit -extract:obj ''output_folder input_folder''/M3GM''file_name''.oni
onisplit -extract:dae ''output_folder input_folder''/M3GM''file_name''.oni


===IDXA===
Or you can simply use [[Vago_(tool)|Vago]].
 
===.dat to .oni===
onisplit -export:''object_name'' ''output_folder input_folder''/''file_name''.dat
The file prefix "M3GM" in ''object_name'' is optional.


==Export==
This command's integration into Vago has been requested.


==Import==
==Import==
onisplit -create:m3gm ''output_folder'' -tex:''TXMPfile_name'' ''input_folder''/''file_name''.obj
The "-tex" argument is optional, but should be always used if there's no MTL file alongside the OBJ. If there is an MTL file, OniSplit will register its texture name in M3GM as a TXMP link.


Or you can simply use [[Vago_(tool)|Vago]].


Note: This command was broken in OniSplit v0.9.86.0 and v0.9.94.0.


{{XML}}
{{XML}}

Latest revision as of 19:10, 27 March 2021

M3GM : Geometry
XML modding tips
  • See HERE to start learning about XML modding.
  • See HERE if you are searching for information on how to handle object coordinates.
  • See HERE for some typical modding errors and their causes.
XML.png
XML

IPge << Other file types >> Mtrl

switch to OBD page

General information

  • The XML on this page was tested with OniSplit v0.9.86.0, v0.9.94.0 and v0.9.95.0.
  • M3GM files can be both local (levelN) and global (level0).
    • Most global M3GMs are used by particles.
    • Most local M3GMs are the models used for doors or animated objects.

File structure

XML tag Content type Description
<M3GM id="..."> integer
<Points> link "#" + instance ID of PNTA.
XYZ and UV coordinates are stored in parallel (same number of entries in PNTA and TXCA).
<VertexNormals> link "#" + instance ID of VCRA.
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).
<FaceNormals> link "#" + instance ID of VCRA.
The second VCRA stores the normals for every face (groups are defined by the second IDXA).
Face normals are used for backface culling.
<TextureCoordinates> link "#" + instance ID of TXCA.
Vertex UVs.
<TriangleStrips> link "#" + instance ID of IDXA.
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.
<FaceNormalIndices> link "#" + instance ID of IDXA.
The second IDXA groups the triangles into faces (oriented by the second VCRA).
<Texture> link TXMPname

PNTA

XML tag Content type Description
<PNTA id="..."> integer Instance ID.
<BoundingBox> -
<Min> float x3
<Max> float x3
<BoundingSphere> -
<Center> float x3
<Radius> float
<Positions> - This is an int32 array for the <Vector3> tags.
<Vector3> float x3 X Y Z coordinate of the point.

VCRA

XML tag Content type Description
<VCRA id="..."> integer Instance ID.
<Normals> - This is an int32 array for the <Vector3> tags.
<Vector3> float x3 X Y Z coordinate of the normal vector.

TXCA

XML tag Content type Description
<TXCA id="..."> integer Instance ID.
<TexCoords> - This is an int32 array for the <Vector2> tags.
<Vector2> float x2 X Y coordinates.

IDXA

XML tag Content type Description
<IDXA id="..."> integer Instance ID.
<Indices> - This is an int32 array for the <Int32> tags.
<Int32> int32
First IDXA
PNTA element ID (used to build triangles with the points of the PNTA instance)
Second IDXA
VCRA element ID (used to assign the normals to every triangle)

Export

.oni to OBJ/DAE

onisplit -extract:obj output_folder input_folder/M3GMfile_name.oni
onisplit -extract:dae output_folder input_folder/M3GMfile_name.oni

Or you can simply use Vago.

.dat to .oni

onisplit -export:object_name output_folder input_folder/file_name.dat

The file prefix "M3GM" in object_name is optional.

This command's integration into Vago has been requested.

Import

onisplit -create:m3gm output_folder -tex:TXMPfile_name input_folder/file_name.obj

The "-tex" argument is optional, but should be always used if there's no MTL file alongside the OBJ. If there is an MTL file, OniSplit will register its texture name in M3GM as a TXMP link.

Or you can simply use Vago.

Note: This command was broken in OniSplit v0.9.86.0 and v0.9.94.0.