Jump to content
Sign in to follow this  
rocket

Using the "Super" Shader (RVMAT material)

Recommended Posts

Making best use of the "Super" shader Materials

The new "super" shader offers excellent options for creating really beautiful objects within ArmA2. I studied Soul_Assain's post on the new RVMAT, and then reviewed BIS's textures to study how they composed the objects. Then I experiemented until I got what looked like "polished metal".

The "super" shader is made up of SEVEN stages, each is described below along with what I did and why:

Specular/Light settings

ambient[] = {1.0, 1.0, 1.0, 1.0};
diffuse[] = {1.0, 1.0, 1.0, 1.0};
forcedDiffuse[] = {0.0, 0.0, 0.0, 0.0};
emmisive[] = {0.0, 0.0, 0.0, 0.0};
specular[] = {1.0, 1.0, 1.0, 0.0};
specularPower = 90.0;

Plenty of info on these in the forums. Play with them to get the desired results.

The Normal Map

{
texture="usec_maule\textures\maule_1_nohq.paa";
uvSource="tex";
class uvTransform
{
	aside[]={1.000000,0.000000,0.000000};
	up[]={0.000000,1.000000,0.000000};
	dir[]={0.000000,0.000000,0.000000};
	pos[]={0.000000,0.000000,0.000000};
};
};

maule_1_NOHQ.jpg

The old faithful normal map! I generated this using the same processes as with ArmA1. Drawing flat lines in greyscale over the diffuse, then using the nVidia plugin in photoshop (height: 1) gave me the right look. Because of the additive effects of the shader, I only wanted subtle detail in the Normal map. I left the channels as they were in photoshop, exported to a PNG, and batch converted using Pal2PacE.exe (see below). The end result should have moved your channels around, the PAA should have: Black red channel, Green channel as before, Blue channel white, and Alpha should have the old contents of the red channel.

The Detail Texture

class Stage2
{
texture="usec_maule\textures\maule_dt.paa";
uvSource="tex";
class uvTransform
{
	aside[]={8.000000,0.000000,0.000000};
	up[]={0.000000,8.000000,0.000000};
	dir[]={0.000000,0.000000,0.000000};
	pos[]={0.000000,0.000000,0.000000};
};
};

maule_DT.jpg

A new twist on an old friend. It's my opinion that the detail texture has a very important role now. I tried two implementations. In the F-35, the ambient occlusion (see below) was taken, and then blurred, and used as the detail texture with the UV tiling set to 1. This resulted in the effects seen on the F35. This didn't work for me, perhaps because my Normal map was so sutble. So I went for the method used with most other vehicles, I used a tiling detail texture.

I tried the BIS textures, but found they were too scratched. So I took one of theirs, and then ran a "dust and scratch" removal filter on it in photoshop, to take the edge off it. This is a greyscale image, I saved it as a PNG and then exported it to PAA.

The Macro Texture

class Stage3
{
texture="#(argb,8,8,3)color(0,0,0,0,MC)";
uvSource="tex";
class uvTransform
{
	aside[]={1.000000,0.000000,0.000000};
	up[]={0.000000,1.000000,0.000000};
	dir[]={0.000000,0.000000,0.000000};
	pos[]={0.000000,0.000000,0.000000};
};
};

Now I don't know about you, but I don't screw around with Macro textures. So I left this part of the shader generating the texture itself. I believe this has a bearing on the roughness of an object.

The Ambient Shadow Texture

class Stage4
{
texture="usec_maule\textures\maule_1_as.paa";
uvSource="tex";
class uvTransform
{
	aside[]={1.000000,0.000000,0.000000};
	up[]={0.000000,1.000000,0.000000};
	dir[]={0.000000,0.000000,0.000000};
	pos[]={0.000000,0.000000,0.000000};
};
};

maule_1_AS.jpg

This, I was excited about! I ran an ambient occlusion bake over my model in 3ds Max (I already had one for the diffuse). The ambient occlusion was used very lightly in the diffuse, to give it a bit of depth, but I was used as the basis for the entire AS texture. Basically, think of ambient occlusion as being "firing light at the model from all angles (ambient) and then seeing where the shadow is".

I took the ambient occlusion bake, and used a "multiply" additive layer for it on top of white. Then I set the RED channel white, and the BLUE channel white, leaving the result only in the GREEN channel. I then saved this as a PNG and batch processed it to PAA.

The Specular Texture

class Stage5
{
texture="usec_maule\textures\maule_1_smdi.paa";
uvSource="tex";
class uvTransform
{
	aside[]={1.000000,0.000000,0.000000};
	up[]={0.000000,1.000000,0.000000};
	dir[]={0.000000,0.000000,0.000000};
	pos[]={0.000000,0.000000,0.000000};
};
};

maule_1_SMDI.jpg

Straightforward, similar to the ambient texture. This tells where is MORE SHINY than other areas. Fiddled with this one very much indeed. Don't have shadows in this, using your painted diffuse before you added any shading is helpful. As per ArmA1, filled in the RED and BLUE channel white, the GREEN channel held all the data.

The Fresnel Texture

class Stage6 {
texture = "#(ai,64,64,1)fresnel(0.92,0.95)";
uvSource = "tex";

class uvTransform {
	aside[] = {1.0, 0.0, 0.0};
	up[] = {0.0, 1.0, 0.0};
	dir[] = {0.0, 0.0, 0.0};
	pos[] = {0.0, 0.0, 0.0};
};
};

OMG FRESNEL!!! These have always confused me, but are a great source of power. The fresnel texture defines incident-angle opacity and colorization for a given channel on an object. Essentially, I guess you could say it alters the color output produced from an object according to its normal. The standard shader generates this texture procedurally, and I didn't really care for much for changing this. If you're making an ice object... have a toy with this! You can get some awesome effects from altering it I suspect, either by making your own texture, or altering the settings.

The Environment Map Texture

class Stage7
{
texture = "ca\data\env_land_co.paa";
uvSource="none";
};

Same as in ArmA1. I experiemented with the ones shipped with ArmA2, and chose the land one. Looked mint, so I left it!

Exporting the textures

I put all the PNG and TGA textures for my project in a folder, along with Pal2PacE.exe, and then created a *.bat file with:

Pal2PacE *.png
Pal2PacE *.tga

In it. Then I simply click the bat file, and it processes any PNG and TGA textures in the folder :)

Share this post


Link to post
Share on other sites

Wow, excellent thing you wrote there.

If you don't mind, could i put up a few requests so i could better understand it?

1. Detail Texture

Although i guess i roughly understand what it does and how it works, could you provide some pics for comparement with/without detail texture? Maybe for a screenshot replacing the detail tex with a blank or so?

Would help to judge what can be achieved with.

2. Ambient Shadow Texture

I doubt you could answer this question: is there any other way to get/create such a texture? I can't afford 3ds max or Photoshop. Some general info what i could try in GIMP (or similar software) to get a more or less decent ambient shadow texture.

But i'm affraid i already know the answer. :(

Besides that, thanks for sharing this really valuable info with us. Much appreciated.

Share this post


Link to post
Share on other sites

2. You can do it with a pencil and a scanner if you wanted to. Just make a black/white picture of where the shadows should be like in (1 in the pic below) then stick this into the green channel of a white rgb image (2).

24896708.jpg

If you have trouble understanding it, them read up on image channels in GIMP

Share this post


Link to post
Share on other sites
2. You can do it with a pencil and a scanner if you wanted to. Just make a black/white picture of where the shadows should be like in (1 in the pic below) then stick this into the green channel of a white rgb image (2).

If you have trouble understanding it, them read up on image channels in GIMP

or

baking.jpg

:)

Share this post


Link to post
Share on other sites

good find indeed :) but for our maxless friend with a pencil that wouldnt do much :P

Share this post


Link to post
Share on other sites

And then you would have to alter it somehow or rebake for use in your difuse tex, if you wanted to.

Share this post


Link to post
Share on other sites

Soul_Assassin, I though with Max but I prefer to Scanline.

Share this post


Link to post
Share on other sites

Also, you can use bodypaint and paint directly onto the 3d object as well. I guess though, if you have BodyPaint (or similar), then you'll probably have a 3d program capable of producing Ambient Occlusion bakes.

Edit:

or

baking.jpg

:)

Also, try using a Spread of 1.0 (in the picture its 0.8). This ensures you use the full spectrum from black to white. Then you can fiddle with the results yourself later.

Edited by Rocket

Share this post


Link to post
Share on other sites

before I got my hands on serious modeling software, I baked ambient and normal maps using xnormal:

http://www.xnormal.net/1.aspx

Its free and works great...possibly even better with the right know-how applied than max or modo's maps.

Share this post


Link to post
Share on other sites
before I got my hands on serious modeling software, I baked ambient and normal maps using xnormal:

http://www.xnormal.net/1.aspx

Its free and works great...possibly even better with the right know-how applied than max or modo's maps.

Indeed, one of our artists has been trying that out at work and he's been saying he finds it much faster than using Maya. Maybe I should check it out!

Share this post


Link to post
Share on other sites

Edit:

Also, try using a Spread of 1.0 (in the picture its 0.8). This ensures you use the full spectrum from black to white. Then you can fiddle with the results yourself later.

Thanks for the explanation, values in the example are default. In mentalray usually i increase the samples only.

Share this post


Link to post
Share on other sites
Thanks for the explanation, values in the example are default. In mentalray usually i increase the samples only.

Definately try playing with the "Max Distance" too, as this controls the maximum distance the ray is cast. It will be in whatever you default units are.

This is with Distance of the rays at 30 in my scene:

bake_dis30.jpg

This is with the Distance of the rays set at 1 in my scene:

bake_dis1.jpg

Just play with the value till you get the right result :)

Share this post


Link to post
Share on other sites

Hey thanks for getting this down rocket, looks like i was way off on what I thought was happening with the shader, cant wait to try this out :)

Share this post


Link to post
Share on other sites
Then I set the RED channel white, and the BLUE channel white, leaving the result only in the GREEN channel.

This is important. If the red and the blue channel have any data then the result will be another.

Add

The most simplest way to swizzle is:

1. Open c:\Program Files\Bohemia Interactive\Tools\BinMake\Pal2PacE\TexConvert.cfg in Notepad.

2. Edit value "B" to "1" :

class specular_diffuseinverse_map
 {
   name = "*_smdi.*";
   format = "DXT1";
   enableDXT = 1;
   channelSwizzleR = "1"; 
   channelSwizzleG = "G"; 
   channelSwizzleB = "[color="Red"]1[/color]";
   channelSwizzleA = "1"; 
   dynRange = 0;
 };

3. Enjoy without Photoshop and 3dsMax :D

TexView or PalToPac does it automatically, don't forget about the prefixes _smdi during saving of file and always have write extension .paa by manual.

Edited by gms

Share this post


Link to post
Share on other sites

xNormal is a great application and gives better results on normals output than baking out of max or zbrush. The creator frequents the art forum I go to called Polycount. So it's nice having him around for feedback/crits on the app.

Share this post


Link to post
Share on other sites

Ok I got the new shaders to work in buldozer, but how do I get them in game? If i exclude rvmats in BINPBO they don't load at all in ArmA 2, also if I use BINPBO with arma 1 materials and them replace them with materials from arma 2, they laod up but not completely, they are missing detail texture and AS map, but smdi and nohq works :butbut:

Share this post


Link to post
Share on other sites

I believe binarizing addons with the current BinPBO isn't fully compatible with ArmA2. The model will be binarized but without materials. There might be a workaround but I'm pretty sure we are going to need updated BinPBO along with some other tools like TexView.

Share this post


Link to post
Share on other sites

Add *rvmat to ignore list if it doesn't work.

Share this post


Link to post
Share on other sites

kju , i tryed that ,but still same problem as Norsu

it get binarized ,but ingame model is without materials :(

Edited by RobertHammer

Share this post


Link to post
Share on other sites

is the rvmat file in the pbo?

of course it can be very well be that binarize doesnt like the new rvmat definition and

it doesnt work altogether.

Share this post


Link to post
Share on other sites

It seems the only way to make new .rvmats to work is just to PBO addon without binirizing it.

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  

×