MSH
From Dragon Age Toolset Wiki
MSH (mesh) files define a 3D mesh, to be referenced by MMH files when creating models in the game.
MSH files are defined using XML source files with the extension .msh.xml. These files are run through the GraphicsProcessorMSH.exe program (found in the Dragon Age\Toolset\export_processors directory) to produce binary files that can be used by the game directly. See 3rd_party_extensions for custom model export and import.
- GraphicsProcessorMSH [-outdir <out-dir>] [-platform <x360,pc,ps3>] [options] [-indir<input-directory> / <input-file>]
Other options include:
- -mmdtogff[Undocumented] - what mmdtogff means or does is unknowns besides it is required to compile msh.xml files.
msh.xml schema in RELAX NG 1.0 format
See Relax NG Specs for information on the RELAX NG 1.0 XML schema format. For a free converter/verifier, see jing-trang.
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<start>
<element name="ModelMeshData">
<attribute name="Name">
<data type="NCName"/>
</attribute>
<attribute name="Version">
<data type="integer"/>
</attribute>
<zeroOrMore>
<element name="MeshGroup">
<attribute name="Name">
<data type="NCName"/>
</attribute>
<optional>
<attribute name="Optimize">
<data type="NCName"/> <!-- "all", "none", or "indices" -->
</attribute>
</optional>
<optional>
<attribute name="optimize"> <!-- Appears to be the same as Optimize, apparently both capitalizations are allowed-->
<data type="NCName"/>
</attribute>
</optional>
<oneOrMore>
<element name="Data">
<optional>
<attribute name="ElementCount">
<data type="integer"/> <!-- If semantic is not "indices", this count gives the number of tuples in the CDATA. -->
</attribute>
</optional>
<optional>
<attribute name="IndexCount">
<data type="integer"/> <!-- If semantic is "indices", this count gives the number of integers in the data's CDATA. -->
</attribute>
</optional>
<optional>
<attribute name="IndexType">
<data type="NCName"/> <!-- Every example of this has the value "Index32", without exception. -->
</attribute>
</optional>
<attribute name="Semantic">
<data type="NCName"/> <!-- "POSITION", "Indices", "TEXCOORD", "TANGENT", "BINORMAL", "NORMAL", "BLENDWEIGHT", "BLENDINDICES", "COLOR" -->
</attribute>
<optional>
<attribute name="Type">
<data type="NCName"/> <!-- indicates how many elements and of what type are in the tuples in the CDATA. Values are "Float4" (four floating point numbers), "Float2" (two floating point numbers), "Short4" (four integers) -->
</attribute>
</optional>
<text/> <!-- contains CDATA with tuples of numbers. For example, a Float2 type MSH had this: <![CDATA[0.195959 0.999994 0.195959 0.266686 0 0.266683 0 1. 0.999999 0.999994 1. 0.166668 ]]> -->
</element>
</oneOrMore>
</element>
</zeroOrMore>
</element>
</start>
</grammar>
Constants
Type enum:
/// 1 float
DECLTYPE_FLOAT1 = 0,
/// 2 floats
DECLTYPE_FLOAT2 = 1,
/// 3 floats
DECLTYPE_FLOAT3 = 2,
/// 4 floats
DECLTYPE_FLOAT4 = 3,
/// 4-byte color
DECLTYPE_COLOR = 4,
/// 4 unsigned bytes
DECLTYPE_UBYTE4 = 5,
/// 2 shorts
DECLTYPE_SHORT2 = 6,
/// 4 shorts
DECLTYPE_SHORT4 = 7,
/// 4 normalized bytes
DECLTYPE_UBYTE4N = 8,
/// 2 normalized shorts
DECLTYPE_SHORT2N = 9,
/// 4 normalized shorts
DECLTYPE_SHORT4N = 10,
/// 2 normalized unsigned shorts
DECLTYPE_USHORT2N = 11,
/// 4 normalized unsigned shorts
DECLTYPE_USHORT4N = 12,
/// 3d unsigned 10/10/10 format
DECLTYPE_UDEC3 = 13,
/// 3d unsigned 10/10/10 normalized
DECLTYPE_DEC3N = 14,
/// 2 16-bit floats
DECLTYPE_FLOAT16_2 = 15,
/// 4 16-bit floats
DECLTYPE_FLOAT16_4 = 16,
DECLTYPE_UNUSED = 0xffffffff
Usage enum:
/// Position
DECLUSAGE_POSITION = 0,
/// Blend weights
DECLUSAGE_BLENDWEIGHT = 1,
/// Blend indices
DECLUSAGE_BLENDINDICES = 2,
/// Normal
DECLUSAGE_NORMAL = 3,
/// Point Size
DECLUSAGE_PSIZE = 4,
/// Texture coordinates
DECLUSAGE_TEXCOORD = 5,
/// Tangent vector
DECLUSAGE_TANGENT = 6,
/// binormal vector
DECLUSAGE_BINORMAL = 7,
/// tessellation factor
DECLUSAGE_TESSFACTOR = 8,
/// PositionT
DECLUSAGE_POSITIONT = 9,
/// color channel
DECLUSAGE_COLOR = 10,
/// fog value
DECLUSAGE_FOG = 11,
/// depth
DECLUSAGE_DEPTH = 12,
/// sample
DECLUSAGE_SAMPLE = 13,
// error/other/unset
DECLUSAGE_UNUSED = 0xffffffff
Example .MSH.XML file
<?xml version="1.0" encoding="UTF-8"?>
<ModelMeshData name="string" Version="int">
<!-- must have 0 or more of these, obviously having at least 1 would be useful -->
<MeshGroup name="string"><!-- optional attributes: Optimize="string"<< all,none, or indicies -->
<!-- must have at least 1 of these, will almost always have at least 6 -->
<Data>
<!-- optional attributes:
ElementCount="int" -- If semantic is not "indices", this is the number of tuples in the CDATA.
IndexCount="int" -- If semantic is "Indices", this is the number of integers in the data's CDATA.
IndexType="string"> -- Every example of this has the value "Index32", without exception.
Semantic="string" -- "POSITION", "Indices", "TEXCOORD", "TANGENT", "BINORMAL", "NORMAL", "BLENDWEIGHT", "BLENDINDICES", "COLOR"
POSITION - vert coordinates
TEXCOORD - texture coordinates
TANGENT/BINROMAL/NORMAL - tangent/bitangent/normal of a vert
Indices - the vert numbers (from the POSITION data block) which the faces are made from.
Note that the texcoords/tangents/bitangents/normals/blendweights/blendindices are by vertex and the ordering MUST be
the same as in the POSITION block
BLENDWEIGHT - the movement weights of up to 4 bones on this vertex
BLENDINDICES - the indices of the bones which the above weights apply to the index is the index of the bone in the accompanying
MMH's corresponding NodeMesh tag
COLOR - vertex color
Type="string" -- indicates how many elements and of what type are in the tuples in the CDATA, as well as the output format for the provided values (as described in the Constants section) Appears to be case-sensitive.
"FLOAT1" (single floating point numbers)
"FLOAT2", "FLOAT16_2" (two floating point numbers)
"FLOAT3" (three floating point numbers)
"FLOAT4", "FLOAT16_4" (four floating point numbers)
"UDEC3", "DEC3N" (undetermined, the format technically allows for three 10-bit values and one 2-bit value )
"COLOR", "UBYTE4", "SHORT4", "UBYTE4N", "SHORT4N", "USHORT4N" (four integers)
"SHORT2", "SHORT2N", "USHORT2N" (two integers)
-->
data <!-- contains CDATA with tuples of numbers. For example, a Float2 type MSH had this:
<![CDATA[0.195959 0.999994 0.195959 0.266686 0 0.266683 0 1. 0.999999 0.999994 1. 0.166668 ]]> -->
</Data>
</MeshGroup>
</ModelMeshData>