User Tools

Site Tools


arma2:texturing:super_shader_tutorial

Super Shader Tutorial

Super Shader Tutorial by Rocket.

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 textures to study how they composed the objects. Then I experimented 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};
	};
};

image

The old faithful normal map! I generated this using the same processes as with ArmA1. Drawing flat lines in gray scale 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};
	};
};

image

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 subtle. 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 gray scale 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};
	};
};

image

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};
	};
};

image

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};
	};
};

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 experimented 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.

arma2/texturing/super_shader_tutorial.txt · Last modified: 2015-08-22 01:27 (external edit)