Quote: "Thanks, I need your help, and I don't think it disturbs Evolved that I post the shader code."
Sorry, I hadn't made the connection when you mentioned mapscape that it would be Evolved's shader. I'll no doubt already have it on my machine as a result so there is no problem there.
I'm afraid I'm not familiar with how that shader is used and without knowing which technique in it you're using I wasn't sure of the best place to add the ambient lighting so I went with what seemed most logical; I applied it to the existing light in the vertex shader. This should also be faster rather than doing the extra calculation per-pixel.
//--------------
// un-tweaks
//--------------
matrix WorldVP:WorldViewProjection;
matrix World:World;
matrix ViewInv:ViewInverse;
//--------------
// tweaks
//--------------
float4 FogColor = { 0.5, 0.5, 0.5, 0 };
float FogRange = 99999999;
float3 LightDir = { -0.5, -0.5, -0.5 };
float3 AmbientLight = { 1.0, 0.4, 0.0 };
//--------------
// Textures
//--------------
texture BaseTX <string Name="";>;
sampler2D Base = sampler_state { texture = <BaseTX>; };
texture BlendTX <string Name="";>;
sampler2D Blend = sampler_state {
texture = <BlendTX>;
MagFilter = Linear;
MinFilter = Point;
MipFilter = None;
};
texture ColoTX <string Name="";>;
sampler2D Colo = sampler_state { texture = <ColoTX>; };
//--------------
// structs
//--------------
struct input {
float4 Pos:POSITION;
float2 UVA:TEXCOORD0;
float2 UVB:TEXCOORD1;
float3 Normal:NORMAL;
};
struct output {
float4 OPos:POSITION;
float2 TexA:TEXCOORD0;
float2 TexB:TEXCOORD1;
float2 TexC:TEXCOORD2;
float3 Light:TEXCOORD3;
float Fog:FOG;
};
//--------------
// vertex shader
//--------------
output VS(input IN) {
output OUT;
OUT.OPos = mul(IN.Pos,WorldVP);
OUT.TexA = IN.UVA;
OUT.TexB = IN.UVB;
OUT.TexC = IN.UVA;
OUT.Light = (0.5f + dot(normalize(mul(IN.Normal, World)), -LightDir) * 0.5f) * AmbientLight;
float3 WPos = mul(IN.Pos, World);
float3 ViewPos = ViewInv[3].xyz - WPos;
OUT.Fog= 1 - length(ViewPos / FogRange);
return OUT;
}
//--------------
// pixel shader
//--------------
float4 PS_Texture(output IN) : COLOR {
float3 Texture1 = tex2D(Base, IN.TexA);
float3 Texture2 = tex2D(Blend, IN.TexB);
return float4((Texture1.xyz * (Texture2 + Texture2)) * (IN.Light + 0.75f), tex2D(Base, IN.TexC).w);
}
float4 PS_Solid(output IN) : COLOR {
float3 Texture1 = tex2D(Colo, IN.TexA);
float3 Texture2 = tex2D(Blend, IN.TexB);
return float4(((Texture1.xyz + Texture2) - 0.5f) * (IN.Light + 0.75f), tex2D(Base, IN.TexC).w);
}
float4 PS_TextureDirlight(output IN) : COLOR {
float3 Texture1 = tex2D(Base, IN.TexA);
float3 Texture2 = tex2D(Blend, IN.TexB);
return float4(Texture1.xyz * (Texture2 + Texture2), tex2D(Base, IN.TexC).w);
}
float4 PS_SolidDirlight(output IN) : COLOR {
float3 Texture1 = tex2D(Colo, IN.TexA);
float3 Texture2 = tex2D(Blend, IN.TexB);
return float4((Texture1.xyz + Texture2) - 0.5f, tex2D(Base, IN.TexC).w);
}
float4 PS_TextureZone(output IN) : COLOR {
float3 Texture1 = tex2D(Base, IN.TexA);
float3 Texture2 = tex2D(Blend, IN.TexB);
return float4(((Texture1.xyz + Texture2) - 0.5f) * ((IN.Light + 0.75f) / 1.5), 0.5);
}
float4 PS_SolidZone(output IN) : COLOR {
float3 Texture1 = tex2D(Colo, IN.TexA);
float3 Texture2 = tex2D(Blend, IN.TexB);
return float4(((Texture1.xyz + Texture2) - 0.5f) * ((IN.Light + 0.75f) / 1.5), 0.5);
}
//--------------
// techniques
//--------------
technique Texture {
pass p0 {
vertexShader = compile vs_1_0 VS();
pixelShader = compile ps_1_0 PS_Texture();
FOGCOLOR = (FogColor);
FOGENABLE = TRUE;
}
}
technique Solid {
pass p0 {
vertexShader = compile vs_1_0 VS();
pixelShader = compile ps_1_0 PS_Solid();
}
}
technique TextureDirlight {
pass p0 {
vertexShader = compile vs_1_0 VS();
pixelShader = compile ps_1_0 PS_TextureDirlight();
FOGCOLOR=(FogColor);
FOGENABLE=TRUE;
}
}
technique SolidDirlight {
pass p0 {
vertexShader = compile vs_1_0 VS();
pixelShader = compile ps_1_0 PS_SolidDirlight();
}
}
technique TextureZone {
pass p0 {
vertexShader = compile vs_1_0 VS();
pixelShader = compile ps_1_0 PS_TextureZone();
FOGCOLOR = (FogColor);
FOGENABLE = TRUE;
}
}
technique SolidZone {
pass p0 {
vertexShader = compile vs_1_0 VS();
pixelShader = compile ps_1_0 PS_SolidZone();
}
}
This line is the key line:
'float3 AmbientLight = { 1.0, 0.4, 0.0 };'. By default this should now add a red/orange shade to anything you render with it. You could set these all to the same value to simply lighten or darken...they're just RGB values applied to the entire object. I'm afraid I don't have any media to test it with to hand but I checked it compiled correctly in Dark Shader so hopefully it will be good to go. If it doesn't work or you have any other questions then let me know and I'll try and help tomorrow (00:30 now and I always get to the office by 07:00 so I need some sleep

).

Previously TEH_CODERER.