I've played a bit with the shaders pack and I tried to add a few things. I've changed the Evolved's normal mapping shader : it can render alpha-transparency and the 3rd texture stage is now used for the specular map.
It's slower and need PS 3.0 but the specular mapping really better the render

(considering it's one of my first attempt with shaders, I think it's quite good

).
// by Evolved
// http://www.vector3r.com/
// modified by math89
//-----------------
// un-tweaks
//-----------------
matrix WorldVP:WorldViewProjection;
matrix World:World;
matrix ViewInv:ViewInverse;
//-----------------
// tweaks
//-----------------
float specPower = 3.0f;
float4 Ambient = {0.3f, 0.3f, 0.3f, 1.0f};
float4 LightPosition_1 = {0.0f, 70.0f, 0.0f, 1.0f};
float4 LightColour_1 = {1.0f, 1.0f, 1.0f, 1.0f};
float LightRange_1 = 55.0f;
float4 LightPosition_2 = {50.0f, 50.0f, 0.0f, 1.0f};
float4 LightColour_2 = {1.0f, 0.0f, 0.0f, 1.0f};
float LightRange_2 = 55.0f;
float4 LightPosition_3 = {100.0f, 50.0f, 0.0f, 1.0f};
float4 LightColour_3 = {0.0f, 1.0f, 0.0f, 1.0f};
float LightRange_3 = 55.0f;
float4 LightPosition_4 = {150.0f, 50.0f, 0.0f, 1.0f};
float4 LightColour_4 = {0.0f, 0.0f, 1.0f, 1.0f};
float LightRange_4 = 55.0f;
float4 LightPosition_5 = {0.0f, 50.0f, 50.0f, 1.0f};
float4 LightColour_5 = {1.0f, 1.0f, 1.0f, 1.0f};
float LightRange_5 = 55.0f;
float4 LightPosition_6 = {50.0f, 50.0f, 50.0f, 1.0f};
float4 LightColour_6 = {1.0f, 0.0f, 0.0f, 1.0f};
float LightRange_6 = 55.0f;
//-----------------
// Texture
//-----------------
texture Base
<
string Name="";
>;
sampler2D Base_Sample = sampler_state
{
texture = <Base>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Linear;
};
texture Normal
<
string Name="";
>;
sampler2D Normal_Sample = sampler_state
{
texture = <Normal>;
};
texture Specular
<
string Name="";
>;
sampler2D Specular_Sample = sampler_state
{
texture = <Specular>;
};
texture Normalizer
<
string Name = "";
>;
samplerCUBE Normalizer_Sample = sampler_state
{
Texture = <Normalizer>;
ADDRESSU = Clamp;
ADDRESSV = Clamp;
};
//-----------------
// structs
//-----------------
struct input
{
float4 pos : POSITION;
float2 UV : TEXCOORD;
float3 Normal : NORMAL;
float3 Tangent : TANGENT;
float3 Binormal : BINORMAL;
};
struct output
{
float4 opos : POSITION;
float2 Uv : TEXCOORD0;
float3 LightVec : TEXCOORD1;
float3 Attenuation : TEXCOORD2;
float3 ViewVec : TEXCOORD3;
};
//-----------------
// vertex shader
//-----------------
output VS_Ambient(input IN)
{
output OUT;
OUT.opos = mul( IN.pos , WorldVP );
OUT.Uv = IN.UV;
OUT.LightVec = 0;
OUT.Attenuation = 0;
OUT.ViewVec = 0;
return OUT;
}
output VS_light1(input IN)
{
output OUT;
OUT.opos = mul( IN.pos , WorldVP );
OUT.Uv = IN.UV;
float3 Wnormal = mul( IN.Normal , World );
Wnormal = normalize( Wnormal );
float3 Wtangent = mul( IN.Tangent , World );
Wtangent = normalize( Wtangent );
float3 Wbinormal = mul( IN.Binormal , World );
Wbinormal = normalize( Wbinormal );
float3 WorldPos = mul( IN.pos , World );
float3x3 NTB = {-Wtangent,Wbinormal,Wnormal};
NTB = transpose(NTB);
float3 LightPos = LightPosition_1 - WorldPos;
OUT.LightVec = mul( LightPos , NTB );
LightPos = WorldPos - LightPosition_1;
OUT.Attenuation = LightPos / LightRange_1;
float3 ViewPos = ViewInv[3].xyz - WorldPos ;
OUT.ViewVec = mul( ViewPos , NTB );
return OUT;
}
output VS_light2(input IN)
{
output OUT;
OUT.opos = mul( IN.pos , WorldVP );
OUT.Uv = IN.UV;
float3 Wnormal = mul( IN.Normal , World );
Wnormal = normalize( Wnormal );
float3 Wtangent = mul( IN.Tangent , World );
Wtangent = normalize( Wtangent );
float3 Wbinormal = mul( IN.Binormal , World );
Wbinormal = normalize( Wbinormal );
float3 WorldPos = mul( IN.pos , World );
float3x3 NTB = {-Wtangent,Wbinormal,Wnormal};
NTB = transpose(NTB);
float3 LightPos = LightPosition_2 - WorldPos;
OUT.LightVec = mul( LightPos , NTB );
LightPos = WorldPos - LightPosition_2;
OUT.Attenuation = LightPos / LightRange_2;
float3 ViewPos = ViewInv[3].xyz - WorldPos ;
OUT.ViewVec = mul( ViewPos , NTB );
return OUT;
}
output VS_light3(input IN)
{
output OUT;
OUT.opos = mul( IN.pos , WorldVP );
OUT.Uv = IN.UV;
float3 Wnormal = mul( IN.Normal , World );
Wnormal = normalize( Wnormal );
float3 Wtangent = mul( IN.Tangent , World );
Wtangent = normalize( Wtangent );
float3 Wbinormal = mul( IN.Binormal , World );
Wbinormal = normalize( Wbinormal );
float3 WorldPos = mul( IN.pos , World );
float3x3 NTB = {-Wtangent,Wbinormal,Wnormal};
NTB = transpose(NTB);
float3 LightPos = LightPosition_3 - WorldPos;
OUT.LightVec = mul( LightPos , NTB );
LightPos = WorldPos - LightPosition_3;
OUT.Attenuation = LightPos / LightRange_3;
float3 ViewPos = ViewInv[3].xyz - WorldPos ;
OUT.ViewVec = mul( ViewPos , NTB );
return OUT;
}
output VS_light4(input IN)
{
output OUT;
OUT.opos = mul( IN.pos , WorldVP );
OUT.Uv = IN.UV;
float3 Wnormal = mul( IN.Normal , World );
Wnormal = normalize( Wnormal );
float3 Wtangent = mul( IN.Tangent , World );
Wtangent = normalize( Wtangent );
float3 Wbinormal = mul( IN.Binormal , World );
Wbinormal = normalize( Wbinormal );
float3 WorldPos = mul( IN.pos , World );
float3x3 NTB = {-Wtangent,Wbinormal,Wnormal};
NTB = transpose(NTB);
float3 LightPos = LightPosition_4 - WorldPos;
OUT.LightVec = mul( LightPos , NTB );
LightPos = WorldPos - LightPosition_4;
OUT.Attenuation = LightPos / LightRange_4;
float3 ViewPos = ViewInv[3].xyz - WorldPos ;
OUT.ViewVec = mul( ViewPos , NTB );
return OUT;
}
output VS_light5(input IN)
{
output OUT;
OUT.opos = mul( IN.pos , WorldVP );
OUT.Uv = IN.UV;
float3 Wnormal = mul( IN.Normal , World );
Wnormal = normalize( Wnormal );
float3 Wtangent = mul( IN.Tangent , World );
Wtangent = normalize( Wtangent );
float3 Wbinormal = mul( IN.Binormal , World );
Wbinormal = normalize( Wbinormal );
float3 WorldPos = mul( IN.pos , World );
float3x3 NTB = {-Wtangent,Wbinormal,Wnormal};
NTB = transpose(NTB);
float3 LightPos = LightPosition_5 - WorldPos;
OUT.LightVec = mul( LightPos , NTB );
LightPos = WorldPos - LightPosition_5;
OUT.Attenuation = LightPos / LightRange_5;
float3 ViewPos = ViewInv[3].xyz - WorldPos ;
OUT.ViewVec = mul( ViewPos , NTB );
return OUT;
}
output VS_light6(input IN)
{
output OUT;
OUT.opos = mul( IN.pos , WorldVP );
OUT.Uv = IN.UV;
float3 Wnormal = mul( IN.Normal , World );
Wnormal = normalize( Wnormal );
float3 Wtangent = mul( IN.Tangent , World );
Wtangent = normalize( Wtangent );
float3 Wbinormal = mul( IN.Binormal , World );
Wbinormal = normalize( Wbinormal );
float3 WorldPos = mul( IN.pos , World );
float3x3 NTB = {-Wtangent,Wbinormal,Wnormal};
NTB = transpose(NTB);
float3 LightPos = LightPosition_6 - WorldPos;
OUT.LightVec = mul( LightPos , NTB );
LightPos = WorldPos - LightPosition_6;
OUT.Attenuation = LightPos / LightRange_6;
float3 ViewPos = ViewInv[3].xyz - WorldPos ;
OUT.ViewVec = mul( ViewPos , NTB );
return OUT;
}
//-----------------
// pixel shader
//-----------------
float4 PS_Ambient(output IN) : COLOR
{
float4 Texture=tex2D(Base_Sample,IN.Uv);
return Texture*Ambient;
}
float4 PS_light1(output IN) : COLOR
{
float4 Texture=tex2D(Base_Sample,IN.Uv);
float alpha = Texture.a;
float3 NormalMap=tex2D(Normal_Sample,IN.Uv)*2-1;
float3 LightV=texCUBE(Normalizer_Sample,IN.LightVec)*2-1;
float3 View=texCUBE(Normalizer_Sample,IN.ViewVec)*2-1;
float Normal = saturate( dot( NormalMap , LightV ) );
float Specular = saturate( dot( reflect( -View , NormalMap ) , LightV ) );
float3 MultSpec=tex2D(Specular_Sample,IN.Uv);
float spec = (MultSpec.r+MultSpec.g+MultSpec.b)/3.0f;
Specular = Specular*spec;
Specular = Specular*Specular*specPower;
float4 DiffuseLight = 1 - dot( IN.Attenuation , IN.Attenuation );
float4 Light = saturate(DiffuseLight*LightColour_1);
Texture.rgb = Texture * (((Normal+Specular)*Light) + Ambient);
Texture.a = alpha;
return Texture ;
}
float4 PS_light2(output IN) : COLOR
{
float4 Texture=tex2D(Base_Sample,IN.Uv);
float3 NormalMap=tex2D(Normal_Sample,IN.Uv)*2-1;
float3 LightV=texCUBE(Normalizer_Sample,IN.LightVec)*2-1;
float3 View=texCUBE(Normalizer_Sample,IN.ViewVec)*2-1;
float Normal = saturate( dot( NormalMap , LightV ) );
float Specular = saturate( dot( reflect( -View , NormalMap ) , LightV ) );
float3 MultSpec=tex2D(Specular_Sample,IN.Uv);
float spec = (MultSpec.r+MultSpec.g+MultSpec.b)/3.0f;
Specular = Specular*spec;
Specular = Specular*Specular*specPower;
float4 DiffuseLight = 1 - dot( IN.Attenuation , IN.Attenuation );
float4 Light = saturate(DiffuseLight*LightColour_2);
Texture.rgb = Texture * ((Normal+Specular)*Light) ;
return Texture;
}
float4 PS_light3(output IN) : COLOR
{
float4 Texture=tex2D(Base_Sample,IN.Uv);
float3 NormalMap=tex2D(Normal_Sample,IN.Uv)*2-1;
float3 LightV=texCUBE(Normalizer_Sample,IN.LightVec)*2-1;
float3 View=texCUBE(Normalizer_Sample,IN.ViewVec)*2-1;
float Normal = saturate( dot( NormalMap , LightV ) );
float Specular = saturate( dot( reflect( -View , NormalMap ) , LightV ) );
float3 MultSpec=tex2D(Specular_Sample,IN.Uv);
float spec = (MultSpec.r+MultSpec.g+MultSpec.b)/3.0f;
Specular = Specular*spec;
Specular = Specular*Specular*specPower;
float4 DiffuseLight = 1 - dot( IN.Attenuation , IN.Attenuation );
float4 Light = saturate(DiffuseLight*LightColour_3);
Texture.rgb = Texture * ((Normal+Specular)*Light) ;
return Texture;
}
float4 PS_light4(output IN) : COLOR
{
float4 Texture=tex2D(Base_Sample,IN.Uv);
float3 NormalMap=tex2D(Normal_Sample,IN.Uv)*2-1;
float3 LightV=texCUBE(Normalizer_Sample,IN.LightVec)*2-1;
float3 View=texCUBE(Normalizer_Sample,IN.ViewVec)*2-1;
float Normal = saturate( dot( NormalMap , LightV ) );
float Specular = saturate( dot( reflect( -View , NormalMap ) , LightV ) );
float3 MultSpec=tex2D(Specular_Sample,IN.Uv);
float spec = (MultSpec.r+MultSpec.g+MultSpec.b)/3.0f;
Specular = Specular*spec;
Specular = Specular*Specular*specPower;
float4 DiffuseLight = 1 - dot( IN.Attenuation , IN.Attenuation );
float4 Light = saturate(DiffuseLight*LightColour_4);
return Texture * ((Normal+Specular)*Light);
Texture.rgb = Texture * ((Normal+Specular)*Light) ;
return Texture;
}
float4 PS_light5(output IN) : COLOR
{
float4 Texture=tex2D(Base_Sample,IN.Uv);
float3 NormalMap=tex2D(Normal_Sample,IN.Uv)*2-1;
float3 LightV=texCUBE(Normalizer_Sample,IN.LightVec)*2-1;
float3 View=texCUBE(Normalizer_Sample,IN.ViewVec)*2-1;
float Normal = saturate( dot( NormalMap , LightV ) );
float Specular = saturate( dot( reflect( -View , NormalMap ) , LightV ) );
float3 MultSpec=tex2D(Specular_Sample,IN.Uv);
float spec = (MultSpec.r+MultSpec.g+MultSpec.b)/3.0f;
Specular = Specular*spec;
Specular = Specular*Specular*specPower;
float4 DiffuseLight = 1 - dot( IN.Attenuation , IN.Attenuation );
float4 Light = saturate(DiffuseLight*LightColour_5);
return Texture * ((Normal+Specular)*Light) ;
Texture.rgb = Texture * ((Normal+Specular)*Light) ;
return Texture;
}
float4 PS_light6(output IN) : COLOR
{
float4 Texture=tex2D(Base_Sample,IN.Uv);
float3 NormalMap=tex2D(Normal_Sample,IN.Uv)*2-1;
float3 LightV=texCUBE(Normalizer_Sample,IN.LightVec)*2-1;
float3 View=texCUBE(Normalizer_Sample,IN.ViewVec)*2-1;
float Normal = saturate( dot( NormalMap , LightV ) );
float Specular = saturate( dot( reflect( -View , NormalMap ) , LightV ) );
float3 MultSpec=tex2D(Specular_Sample,IN.Uv);
float spec = (MultSpec.r+MultSpec.g+MultSpec.b)/3.0f;
Specular = Specular*spec;
Specular = Specular*Specular*specPower;
float4 DiffuseLight = 1 - dot( IN.Attenuation , IN.Attenuation );
float4 Light = saturate(DiffuseLight*LightColour_6);
return Texture * ((Normal+Specular)*Light) ;
Texture.rgb = Texture * ((Normal+Specular)*Light) ;
return Texture;
}
//-----------------
// techniques
//-----------------
technique Ambient
{
pass p1
{
vertexShader = compile vs_2_0 VS_Ambient();
pixelShader = compile ps_2_0 PS_Ambient();
}
}
technique light1
{
pass p1
{
vertexShader = compile vs_1_1 VS_light1();
pixelShader = compile ps_3_0 PS_light1();
}
}
technique light2
{
pass p1
{
vertexShader = compile vs_1_1 VS_light1();
pixelShader = compile ps_3_0 PS_light1();
}
pass p2
{
vertexShader = compile vs_1_1 VS_light2();
pixelShader = compile ps_3_0 PS_light2();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
}
technique light3
{
pass p1
{
vertexShader = compile vs_1_1 VS_light1();
pixelShader = compile ps_2_0 PS_light1();
}
pass p2
{
vertexShader = compile vs_1_1 VS_light2();
pixelShader = compile ps_2_0 PS_light2();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p3
{
vertexShader = compile vs_1_1 VS_light3();
pixelShader = compile ps_2_0 PS_light3();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
}
technique light4
{
pass p1
{
vertexShader = compile vs_1_1 VS_light1();
pixelShader = compile ps_2_0 PS_light1();
}
pass p2
{
vertexShader = compile vs_1_1 VS_light2();
pixelShader = compile ps_2_0 PS_light2();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p3
{
vertexShader = compile vs_1_1 VS_light3();
pixelShader = compile ps_2_0 PS_light3();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p4
{
vertexShader = compile vs_1_1 VS_light4();
pixelShader = compile ps_2_0 PS_light4();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
}
technique light5
{
pass p1
{
vertexShader = compile vs_1_1 VS_light1();
pixelShader = compile ps_2_0 PS_light1();
}
pass p2
{
vertexShader = compile vs_1_1 VS_light2();
pixelShader = compile ps_2_0 PS_light2();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p3
{
vertexShader = compile vs_1_1 VS_light3();
pixelShader = compile ps_2_0 PS_light3();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p4
{
vertexShader = compile vs_1_1 VS_light4();
pixelShader = compile ps_2_0 PS_light4();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p5
{
vertexShader = compile vs_1_1 VS_light5();
pixelShader = compile ps_2_0 PS_light5();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
}
technique light6
{
pass p1
{
vertexShader = compile vs_1_1 VS_light1();
pixelShader = compile ps_2_0 PS_light1();
}
pass p2
{
vertexShader = compile vs_1_1 VS_light2();
pixelShader = compile ps_2_0 PS_light2();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p3
{
vertexShader = compile vs_1_1 VS_light3();
pixelShader = compile ps_2_0 PS_light3();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p4
{
vertexShader = compile vs_1_1 VS_light4();
pixelShader = compile ps_2_0 PS_light4();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p5
{
vertexShader = compile vs_1_1 VS_light5();
pixelShader = compile ps_2_0 PS_light5();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
pass p6
{
vertexShader = compile vs_1_1 VS_light6();
pixelShader = compile ps_2_0 PS_light6();
AlphaBlendEnable = True;
SrcBlend = One;
DestBlend = One;
}
}