thanks for your comments!
ok,here you go with the scalable version:
Code:
material mtl_himmel
{
effect = "himmel.fx";
}
somewhere else you set or change the variables (or fade those values in functions and create various fog):
Code:
mtl_himmel.skill1 = float(50); //vertical offset
mtl_himmel.skill2 = float(1500); //fading scale
mtl_himmel.skill3 = float(0.25); //density
and here is the new fx-file:
Code:
float4x4 matWorldViewProj;
float4 vecFog;
float4 vecSkill1;
struct VS_IN
{
float4 position : POSITION;
float2 texCoord : TEXCOORD0;
};
struct VS_OUT
{
float4 position : POSITION;
float2 texCoord : TEXCOORD0;
float Fog : FOG;
};
VS_OUT mainVS (VS_IN In)
{
VS_OUT Out;
Out.position = mul(In.position,matWorldViewProj);
Out.Fog = ((In.position.y-vecSkill1.x)/vecSkill1.y)-vecSkill1.z;
Out.texCoord = In.texCoord;
return Out;
}
texture entSkin1;
sampler basemap = sampler_state
{
Texture = <entSkin1>;
MipFilter = LINEAR;
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = Wrap;
Addressv = Wrap;
};
float4 mainPS (VS_OUT In) : COLOR0
{
return tex2D(basemap,In.texCoord);
}
technique heightFog
{
pass p0
{
VertexShader = compile vs_1_1 mainVS();
PixelShader = compile ps_1_1 mainPS();
}
}