This is my first running version of per-pixel diffuse lighting with texture blending.
The texture ops are:
Code:
float4 PS(float3 Light : TEXCOORD0,float3 Norm : TEXCOORD1,
float2 TerrainUV : TEXCOORD2,float2 DetailUV : TEXCOORD3) : COLOR
{
//ambient
float4 A={0.1,0.1,0.1,0.1};
//vDic=intensity * color
vector TerrainColor=tex2D(Terrain,TerrainUV);
vector DetailColor=tex2D(Detail,DetailUV);
vector MixColor=(TerrainColor+DetailColor);
return A*MixColor+vDic * saturate(dot(Light,Norm));
}
As you can see I'm just currently doing additive texture blending, but it looks great. The per-pixel lighting is sooooo much better than per-vertex.
Now that I've got it working and understand a lot more about pixel and vertex shaders, look out for some razzle dazzle effects.