sampler TxBase: register(s0);
float4 diffuse;
float4 emissive;
float4 FogColor;

struct PS_INPUT
{
  float2 texCoord0: TEXCOORD0;
  float3 light: TEXCOORD1;
  float fog: TEXCOORD2;
};

float4 main (PS_INPUT IN): COLOR0
{
      float4 tex=tex2D(TxBase, IN.texCoord0);
      float3 colorp=float3((emissive+IN.light*(diffuse-emissive))*tex.xyz);
      return float4(float3(colorp*(1-IN.fog) + FogColor.xyz*IN.fog).xyz,diffuse.a*tex.a);
}