xr:mat User Parameters
- Last UpdatedDec 13, 2023
- 2 minute read
Material user parameters
The Material user parameters allow you to modify both shader and material associated to a scene object. They are used both for manual and semi-automatic shader and materials. assignment.
Shader manual assignment
By default, the FBX Importer will try to guess what predefined shader to use, and will also import the Material parameters that it can understand by looking inside the FBX material structure (for example Diffuse, Bump).
Manually assign a specific shadergen shader
You can manually assign a specific shadergen shader by assigning specific xr:mat properties to an object.
-
Set xr:mat;$ShaderGen to True or 1.
-
Set xr:mat:$ShaderName to the name of the shadergen to be used.
Note: When manually assigning a shader, all properties exported into the FBX material structure are ignored and only the mat:xr material parameters are considered.
Specifying Material parameters
The Material parameters are used in both manual and automated shader assignment mode. In manual shader assignment mode, the material parameters are the only values that will be included in the imported MWX. In automatic shader assignment mode, the Material parameters will be added to the parameters exported into the FBX material data.
For an object with a single material, all xr:params can be assigned both to the object or to the material.
For an object with multi-materials, the common parameters must be assigned to the object with the sub material specific to each material.
Code example
In order to get the following MWX result, you need to specify the following xr:params:
Object
|
xr:mat:$ShaderGen |
True |
|
xr:mat:$ShaderName |
engine|aSimpleShader |
|
xr:mat:fBlendFactor |
1.00 |
|
xr:mat:mRef |
cube.dds |
Sub-material 1
|
xr:mat:mDiffuseMap |
pallina.tga |
Sub-material 2
|
xr:mat:mDiffuseMap |
asfalto.png |
<Material type="DX11" version="1.1">
<pass name="standard" shader="engine|aSimpleShader">
<param type="unknown" name="fBlendFactor" value="1.000000"/>
<param type="unknown" name="mRef" value="cube.dds"/>
<subParams>
<param type="unknown" name="mDiffuseMap" value="pallina.tga"/>
</subParams>
<subParams>
<param type="unknown" name="mDiffuseMap" value=“asfalto.png"/>
</subParams>
</pass>
</Material>