Rvmat File Format: Difference between revisions

From Bohemia Interactive Community
m (Text replacement - ";[ ]+ " to "; ")
(Add TexGen info, thanks to Dedmen)
Line 1: Line 1:
==Work In Progress==
Rvmat files are the texture (material) files introduced with {{arma1}}.
== Intro ==
This file format is documented here to properly indicate all file types of BI. It is not intended to be other than a quick reference to the much more complete rvmat description elsewhere.
== General ==
Rvmat files are the texture (material) files for Armed Assault.


The text they contain are classic token pair and classname structures. As such, they are raPifiable just like a config or a mission.sqm. Normally, Rvmats are raPified before use by the game engine, but, just like similar files (mission.sqm eg) they can be passed in text form and let the engine compile it there and then. This, obviously creates an engine load lag time before game start.
The text they contain are classic token pair and classname structures. As such, they are raPifiable just like a config or a mission.sqm.
== Structure ==
Normally, Rvmats are raPified before use by the game engine, but, just like similar files (e.g {{hl|mission.sqm}}) they can be passed in text form and let the engine compile it there and then. Doing so however creates an engine load lag time before game start.
The minimum construct of an rvmat file is as follows;


//class NameOfRvmatFile{
  Ambient[]={D3DCOLORVALUES};
  Diffuse[]={D3DCOLORVALUES};
  ForcedDiffuse[]={D3DCOLORVALUES};
  emmisive[] = {D3DCOLORVALUES};
  specular[] = {D3DCOLORVALUES};
  specularPower = 64.0;
  PixelShaderID = "Normal";
  VertexShaderID = "BasicAlpha";
  class Stage0
  {
    texture="#(rgb,8,8,3)color(0,0,1,1,SMDI)";
    uvSource="tex";
    Filter="Point";
  };
  ......
  class StageLast
  {
    texture="#(rgb,8,8,3)color(0,0,1,1,SMDI)";
    uvSource="tex";
    Filter="Point";
  };
//};


where D3DCOLORVALUE = float r,g,b,a;
== Base Format ==
 
The minimum construct of an rvmat file is as below; however, it is recommended to use {{Link|#TexGen}} as described above to save on {{hl|uvTransform}} declarations.
<syntaxhighlight lang="cpp">
class NameOfRvmatFile
{
// rgba values being replaced by the value of your choice
Ambient[] = { r, g, b, a };
Diffuse[] = { r, g, b, a };
ForcedDiffuse[] = { r, g, b, a };
emmisive[] = { r, g, b, a };
specular[] = { r, g, b, a };
specularPower = 64.0;
PixelShaderID = "Normal";
VertexShaderID = "BasicAlpha";
class Stage0
{
texture = "#(rgb,8,8,3)color(0,0,1,1,SMDI)";
uvSource = "tex";
Filter = "Point";
};
// ...
class StageLast
{
texture = "#(rgb,8,8,3)color(0,0,1,1,SMDI)";
uvSource = "tex";
Filter = "Point";
};
};
</syntaxhighlight>
 
Note that PixelShaderID is a clear example of Rap files NOT being the popularly termed 'binarised' files. If it were binarised, BasicAlpha would be integer 3.
 
 
== TexGen Usage ==
 
TexGen usage prevents {{hl|uvTransform}} to be reminded in every stage.
 
<syntaxhighlight lang="cpp">
ambient[] = { 1, 1, 1, 1 };
diffuse[] = { 1, 1, 1, 1 };
forcedDiffuse[] = { 0, 0, 0, 0 };
emmisive[] = { 0, 0, 1, 10 };
specular[] = { 1, 1, 1, 1 };
specularPower = 100;
PixelShaderID = "SuperExt";
VertexShaderID = "Super";
 
class TexGen0
{
uvSource = "tex";
class uvTransform
{
aside[] = { 1, 0, 0 };
up[] = { 0, 1, 0 };
dir[] = { 0, 0, 1 };
pos[] = { 0, 0, 0 };
};
};
 
class TexGen1
{
uvSource = "none";
};
 
class Stage1
{
texture = "z\wolf\addons\wolflogo\tex\wolflogo_nohq.paa";
texGen = 0;
};
class Stage2
{
texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)";
texGen = 0;
};
class Stage3
{
texture = "#(argb,8,8,3)color(0,0,0,0,MC)";
texGen = 0;
};
class Stage4
{
texture = "z\wolf\addons\wolflogo\tex\wolflogo_as.paa";
texGen = 0;
};
class Stage5
{
texture = "z\wolf\addons\wolflogo\tex\wolflogo_smdi.paa";
texGen = 0;
};
class Stage6
{
texture = "#(ai,64,64,1)fresnel(1.29,0.01)";
texGen = 1;
};
class Stage7
{
texture = "a3\data_f\env_co.paa";
texGen = 0;
};
class Stage8
{
texture = "z\wolf\addons\wolflogo\tex\wolflogo_em.paa";
texGen = 0;
};
</syntaxhighlight>


Note that PixelShaderID is a clear example of Rap files NOT being the popularly termed 'binarised' files. If it were binarised, BasicAlpha would be integer 3


{{GameCategory|ofp|Modelling}}
{{GameCategory|ofp|Modelling}}
[[Category:BIS_File_Formats]]
[[Category:BIS_File_Formats]]
{{GameCategory|arma1|File Formats}}
{{GameCategory|arma1|File Formats}}

Revision as of 14:54, 7 May 2025

Rvmat files are the texture (material) files introduced with Armed Assault.

The text they contain are classic token pair and classname structures. As such, they are raPifiable just like a config or a mission.sqm. Normally, Rvmats are raPified before use by the game engine, but, just like similar files (e.g mission.sqm) they can be passed in text form and let the engine compile it there and then. Doing so however creates an engine load lag time before game start.


Base Format

The minimum construct of an rvmat file is as below; however, it is recommended to use TexGen as described above to save on uvTransform declarations.

class NameOfRvmatFile
{
	// rgba values being replaced by the value of your choice
	Ambient[] = { r, g, b, a };
	Diffuse[] = { r, g, b, a };
	ForcedDiffuse[] = { r, g, b, a };
	emmisive[] = { r, g, b, a };
	specular[] = { r, g, b, a };
	specularPower = 64.0;
	PixelShaderID = "Normal";
	VertexShaderID = "BasicAlpha";
	class Stage0
	{
		texture = "#(rgb,8,8,3)color(0,0,1,1,SMDI)";
		uvSource = "tex";
		Filter = "Point";
	};
	// ...
	class StageLast
	{
		texture = "#(rgb,8,8,3)color(0,0,1,1,SMDI)";
		uvSource = "tex";
		Filter = "Point";
	};
};

Note that PixelShaderID is a clear example of Rap files NOT being the popularly termed 'binarised' files. If it were binarised, BasicAlpha would be integer 3.


TexGen Usage

TexGen usage prevents uvTransform to be reminded in every stage.

ambient[] = { 1, 1, 1, 1 };
diffuse[] = { 1, 1, 1, 1 };
forcedDiffuse[] = { 0, 0, 0, 0 };
emmisive[] = { 0, 0, 1, 10 };
specular[] = { 1, 1, 1, 1 };
specularPower = 100;
PixelShaderID = "SuperExt";
VertexShaderID = "Super";

class TexGen0
{
	uvSource = "tex";
	class uvTransform
	{
		aside[] = { 1, 0, 0 };
		up[] = { 0, 1, 0 };
		dir[] = { 0, 0, 1 };
		pos[] = { 0, 0, 0 };
	};
};

class TexGen1
{
	uvSource = "none";
};

class Stage1
{
	texture = "z\wolf\addons\wolflogo\tex\wolflogo_nohq.paa";
	texGen = 0;
};
class Stage2
{
	texture = "#(argb,8,8,3)color(0.5,0.5,0.5,1,DT)";
	texGen = 0;
};
class Stage3
{
	texture = "#(argb,8,8,3)color(0,0,0,0,MC)";
	texGen = 0;
};
class Stage4
{
	texture = "z\wolf\addons\wolflogo\tex\wolflogo_as.paa";
	texGen = 0;
};
class Stage5
{
	texture = "z\wolf\addons\wolflogo\tex\wolflogo_smdi.paa";
	texGen = 0;
};
class Stage6
{
	texture = "#(ai,64,64,1)fresnel(1.29,0.01)";
	texGen = 1;
};
class Stage7
{
	texture = "a3\data_f\env_co.paa";
	texGen = 0;
};
class Stage8
{
	texture = "z\wolf\addons\wolflogo\tex\wolflogo_em.paa";
	texGen = 0;
};