MWX file example
- Last UpdatedDec 06, 2023
- 2 minute read
There are two different types of MWX files:
-
MWX exported from 3DStudio Max (standard .mwx)
-
MWX generated when importing an .rvm file (RVM converted to MWX).
These two files contains a different set of nodes.
The following example is a standard MWX file. Please refer to RVM converted to MWX for information about converted RVM files.
Link to geometry
The geometry in this case is incorporated within the MWX, otherwise we would see a link to the .geom file like this one.
[...]
<geometry>
<Geometry name="graphic_context|itemName" file="graphic_context\graphic_context_itemName.geom" version="1"/>
</geometry>
[...]
Code example
This is a code example of a simple .mwx file defining a mesh.
The file contains only one mesh with three vertices. This object has 2 UV channels. It uses a custom shader that requires just one parameter (fAlphaMul) and one texture. This information is populated via 3D Studio Max material data and/or user defined properties, such as in ShaderGen exports.
<?xml version="1.0" encoding="utf-8" ?>
<mwx version="1.0">
<Mesh type="Unified" name="graphic_context|itemName" version="1">
<transform scale="1.0 1.0 1.0" rotation="-0.0 -0.0 -0.0 1.0" translation="-0.0 0.0 0.0"/>
<material>
<Material type="Unified" version="1">
<opacity value="X"/>
<emissiveMul value="X"/>
<screenRefraction value="false"/>
<refractivity value="X"/>
<reflectivity value="X"/>
<shader name="ShaderLibrary|ShaderGroup|customShaderName">
<param type="float" name="fAlphaMul" value="0.0"/>
<texture type="simple" name="textureName" file="filename.fileExtension"/>
</shader>
<shaderLights>
<light name="lightName"/>
</shaderLights>
</Material>
</material>
<geometry>
<Geometry name="graphic_context|itemName" version="1">
<vertices num="3">
<vertex position="0.5 0.0 0.5" normal="0.0 -1.0 0.0" tangent="-1.0 0.0 -0.0" binormal="0.0 0.0 -1.0" uv0="0.0 0.0" uv2="0.0 0.0" />
<vertex position="-0.5 0.0 0.5" normal="0.0 -1.0 0.0" tangent="-1.0 0.0 -0.0" binormal="0.0 0.0 -1.0" uv0="1.0 0.0" uv2="1.0 0.0" />
<vertex position="-0.5 0.0 -0.5" normal="0.0 -1.0 0.0" tangent="-1.0 0.0 -0.0" binormal="0.0 0.0 -1.0" uv0="1.0 1.0" uv2="1.0 1.0" />
</vertices>
<faces num="1">
<face indices="0 1 2"/>
</faces>
</Geometry>
</geometry>
<obbox center="0.0 0.5 0.0" hsize="0.5 0.5 0.5" uaxis="1.0 0.0 0.0" vaxis="0.0 1.0 0.0" waxis="0.0 0.0 1.0"/>
<sphere center="0.0 0.5 0.0" radius="0.866025"/>
</Mesh>