Jump to content
Sign in to follow this  
sakura_chan

Question about island .rvmats

Recommended Posts

I've never made an island before, but I wanted to learn about how they were set up just for fun. The easiest way is to just directly edit a default island like Stratis. It left me with only one question: Why are there multiple rvmats for each texture block? For example, in the Stratis map, the block _002-002 has 18 different rvmats. It seems that editing the rvmat with the most "layers" is the only one that actually affects the terrain, ie "P_002-001_L02_L03_L04_L06_L07.rvmat" as apposed to "P_002-001_L02_N_N_N_L07.rvmat". I know these extra rvmats are listed in the island's .wrp, so what exactly do they do? Some sort of LOD system? I don't think so... Maybe something to do with AI? Any map makers please let me know!

Share this post


Link to post
Share on other sites

Okay so no one knows? I know user made islands have these extra rvmats too. Is there no one who knows what they do?

Share this post


Link to post
Share on other sites
Okay so no one knows? I know user made islands have these extra rvmats too. Is there no one who knows what they do?

The terrain is split into multiple components, and each of those components is its own 3d mesh generated by the engine. Each of those components uses its own rvmat.

I think it allows you to have more than four different terrain layers on the whole terrain, as long as you don't have over four terrain layers in a single component.

Edited by Xendance

Share this post


Link to post
Share on other sites
I've never made an island before, but I wanted to learn about how they were set up just for fun. The easiest way is to just directly edit a default island like Stratis. It left me with only one question: Why are there multiple rvmats for each texture block? For example, in the Stratis map, the block _002-002 has 18 different rvmats. It seems that editing the rvmat with the most "layers" is the only one that actually affects the terrain, ie "P_002-001_L02_L03_L04_L06_L07.rvmat" as apposed to "P_002-001_L02_N_N_N_L07.rvmat". I know these extra rvmats are listed in the island's .wrp, so what exactly do they do? Some sort of LOD system? I don't think so... Maybe something to do with AI? Any map makers please let me know!

I happened to be looking in to this recently (and did a bit more investigation on it today).

Each land segment (identified by a grid square like 002-001) is broken down into land grid cells. You can see them on the following diagram of a single mask texture tile (which would correspond to a single .paa):

6owR4RJ.png

A land grid cell is then further divided into terrain grid cells, which correspond to your height map. In the above diagram each of the grid vertices in the "Terrain Grid Cell" would have a height associated with it in your heightmap. For example a single land grid cell might be a 48 x 48 mesh of heights (RV also decimates these meshes as part of automatic LOD'ing, but that isn't something that affects maps or map file formats).

ARMA draws terrain by sending an entire land grid cell (the 48 x 48 mesh) to a single call of DirectX. When you do a draw call in DirectX you send through up to 16 textures (to the pixel shader, which makes 16 a hard limit), and these match the "StageN" stage numbers in the rvmat file.

Although your entire terrain tile might use 4 to 6 colours, each terrain grid cell might use fewer.

For example, the terrain grid cell marked "A" in the diagram uses all four colours (of a Terrain15 shader rvmat, you can use more in others), and therefore needs all of the texture slots filled out:

L01_L02_L03_L04

By the way, the positions correspond to BLACK_RED_GREEN_BLUE_(MAGIC ALPHA SURFACE THAT VISITOR 3 CAN'T PRODUCE), so black is L01, red is L02, and so on.

However "B" only uses green and blue:

N_N_L03_L04

Cell "C" only uses blue:

N_N_N_L04

Both "D" and "E" use only red and blue, so they can both share the N_L1_N_L3 rvmat.

The reason for doing this is probably because textures are demand loaded from disk and into the graphics card. Also Visitor 3 creates maps that use older shaders (Terrain1, Terrain3, Terrain15 and so on). The numbers (1, 3, 15) are a bitmask (0001 binary, 0011 binary, and 1111 binary respectively) of which colours from the mask are supported by the shader. The fewer surface textures that the shader has going in to it, the less GPU code runs per pixel. ARMA 2 and ARMA 2 OA maps abandoned this in favor of a single (6 surface) "TerrainX" shader (although all the community maps produced by Visitor3 still use the Terrain1, etc shader) and ARMA 3 uses "TerrainSNX" (a fixed 5 surface shader with a normal satellite layer).

How does RV know which rvmat to use? When you import a satmap and satmask in Visitor 3 it builds a linear list of all of the rvmats used (often around 1000 in the single list), and a matrix of all of the land grid cells (256 x 256 is a fairly common size for it, but it depends on the map parameters). The matrix of land grid cells has indices into the list of rvmat file names; so when it wants to render a land grid cell mesh it (presumably) just looks up the matrix, then looks up the rvmat file, and then uses that. The rvmat list and matrix are both stored in your .pew and then end up in the .wrp.

It also seems to me like there would be nothing stopping you from using 4-6 textures in one land grid cell and up to 4-6 different textures in another (on the same satellite mask tile) as long as you were careful to ensure that at the edge between them the same texture was being used.

(Edit) Miro mentioned that RV then merges them all back into one material, which would explain:

It seems that editing the rvmat with the most "layers" is the only one that actually affects the terrain, ie "P_002-001_L02_L03_L04_L06_L07.rvmat" as apposed to "P_002-001_L02_N_N_N_L07.rvmat".

Presumably in the merging process the edits you made were overwritten by the original surfaces (that ARMA would assume to be exactly the same).

Edited by IanBanks
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Although your entire terrain tile might use 4 to 6 colours, each terrain grid cell might use fewer.

For example, the terrain grid cell marked "A" in the diagram uses all four colours (of a Terrain15 shader rvmat, you can use more in others), and therefore needs all of the texture slots filled out:

L01_L02_L03_L04

By the way, the positions correspond to BLACK_RED_GREEN_BLUE_(MAGIC ALPHA SURFACE THAT VISITOR 3 CAN'T PRODUCE), so black is L01, red is L02, and so on.

However "B" only uses green and blue:

N_N_L03_L04

Cell "C" only uses blue:

N_N_N_L04

Both "D" and "E" use only red and blue, so they can both share the N_L1_N_L3 rvmat.

I would like to expand on this.

as he said the rvmats are

Black _ Red _ Green _ Blue _ Alpha-128

0,0,0,255 _ 255,0,0,255 _ 0,255,0,255 _ 0,0,255,255 _ #,#,#,128

and if it uses only 4 textures it would look like

L01_L02_L03_L04 with an unused texture looking like L01_L02_L03_N

where L01 would refer to the texture in the map data folder

but something that isn't mentioned is the second Rvmat that is provided.

it would also follow the format of the first Rvmat using the same amount of textures. and follows a similar color format

but the numbers are a little different and relate to a different texture

the colors ive found so far are

black _ Brown _ empty(maybe orange) _empty _ Alpha-0

8,0,0,255 _ 170,85,0,255 _ N _ N _ #,#,#,0

A2 operation arrowhead maps had the same color layout when I looked through them. back when I was looking though some of the A2 maps I found a orange color but I couldn't find it with A3 so I don't know the value.

Share this post


Link to post
Share on other sites

Great info

All these years I thought the extra rvmats were because of the mountains and such lol

For colours I guess these are linked to map legend and layers in conjuction with a 32 bit ? Lca (opposed to 24 bit lco for sat) texture for mask so possible when making in visitor 4 , 6 colours per section are ok .

Share this post


Link to post
Share on other sites

Black _ Red _ Green _ Blue _ Alpha-128

0,0,0,255 _ 255,0,0,255 _ 0,255,0,255 _ 0,0,255,255 _ #,#,#,128

There's Alpha = 0 and Alpha = 128 by the way. Also with the alpha surfaces, the RG and B values probably need to be a specific color to have blends across surfaces working properly. When you have (for example) a red satmask pixel next to a green satmask pixel the DirectX/GPU texture interpolation between those two colors produces a smooth blend between them. Having different RGB channel values for the alpha pixels would produce a different transition between a coloured surface and the alpha one.

but something that isn't mentioned is the second Rvmat that is provided.

it would also follow the format of the first Rvmat using the same amount of textures. and follows a similar color format

but the numbers are a little different and relate to a different texture

the colors ive found so far are

black _ Brown _ empty(maybe orange) _empty _ Alpha-0

8,0,0,255 _ 170,85,0,255 _ N _ N _ #,#,#,0

A2 operation arrowhead maps had the same color layout when I looked through them. back when I was looking though some of the A2 maps I found a orange color but I couldn't find it with A3 so I don't know the value.

Haven't seen this, do you have an example?

Brown areas from what I've seen are usually caused when you exceed the 4 colour limit in the Visitor 3 import process. It is more common in overlap areas of texture tiles (where the 4 colour rule is less easy to follow and the results of violating it are invisible) but some maps have it in the middle of the tile too.

It's barely visible as long as the surface textures don't clash; you just get a flat blend of two surfaces and the clutter usually hides it anyhow.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×