> For the complete documentation index, see [llms.txt](https://mrcmodding.gitbook.io/arma-3-object-builder/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mrcmodding.gitbook.io/arma-3-object-builder/tools/materials/rvmat-templates.md).

# RVMAT Templates

RVMAT Templates are used by the Templates tool of the [Materials](/arma-3-object-builder/tools/materials.md) tools. A template is essentially a normal RVMAT file, with the exception that it has special place holder values where file paths should be automatically inserted.

{% hint style="info" %}
Custom templates can be added through the [Custom Data JSON](/arma-3-object-builder/general/custom-data-json.md) file.
{% endhint %}

### Process

The templating process will take the selected folder path, texture set name and the specificed template file and process it through the following steps:

1. locating placeholders
2. precomputing possible acceptable file paths for all placeholders
3. determining final values:
   * if Ensure Files Exist is enabled:
     * check which acceptable files exist
     * if no files exist, use default value of the placeholder
     * otherwise use the first acceptable path
   * otherwise:
     * use first acceptable file regardless of whether or not it exists
4. substituting final values (file paths are made relative to the [Project Root](/arma-3-object-builder/general/add-on-preferences.md#project-root) of the add-on preferences if possible)
5. writing output file

### Placeholders

{% code title="Placeholder syntax" %}

```
<accepted texture types|accepted file extensions|default value>
```

{% endcode %}

A placeholder consists of 3 parts wrapped in `<` and `>` symbols, and separated by `|` symbols.

1. comma separated list of accepted texture type suffixes (eg.: `NO,NOHQ`)
2. comma separated list of accepted file types (e.: `TGA,PAA,PAC`)
3. default value (eg.: `#(argb,8,8,3)color(0.5,0.5,1,1,NOHQ)`

{% hint style="warning" %}

* There should be no spaces in the texture and file types lists, and no spaces around the separating `|` characters.
* The placeholder as a whole, or the default value should not be wrapped in quote marks, the templating process will insert them automatically.
  {% endhint %}

### Example

{% code title="weapon.rvmat\_template" %}

```cpp
// class StageTI
// {
// 	texture = <TI|PAA|#(argb,8,8,3)color(1,0,0,0,TI)>;
// };
ambient[] = {1, 1, 1, 1};
diffuse[] = {1, 1, 1, 1};
forcedDiffuse[] = {0, 0, 0, 0};
emmisive[] = {0, 0, 0, 1};
specular[] = {0.4, 0.4, 0.4, 1};
specularPower = 80;
PixelShaderID = "Super";
VertexShaderID = "Super";
class Stage1
{
    texture = <NOHQ|PAA|#(argb,8,8,3)color(0.5,0.5,1,1,NOHQ)>;
	uvSource = "tex";
};
class Stage2
{
	texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)";
	uvSource="tex";
};
class Stage3
{
	texture = "(argb,8,8,3)color(0,0,0,0,MC)";
	uvSource = "tex";
};
class Stage4
{
	texture = <AS|PAA|#(argb,8,8,3)color(1,1,1,1,AS)>;
	uvSource = "tex";
};
class Stage5
{
	texture = <SMDI|PAA|#(argb,8,8,3)color(1,0.1,0.2,1,SMDI)>;
	uvSource = "tex";
};
class Stage6
{
	texture = "#(ai,64,64,1)fresnel(10.4,8.3)";
	uvSource = "none";
};
class Stage7
{
	texture = "a3\data_f\env_co.paa";
	useWorldEnvMap = "true";
	uvSource = "tex";
};

```

{% endcode %}
