// Calculate the ambient term:
float4 Ambient = AmbientIntensity * vecAmbient;
// Calculate the diffuse term:
InNormal = normalize(InNormal);
float4 Diffuse = DiffuseIntensity * SunColor * saturate(dot(-vecSunDir, InNormal));
// Fetch the pixel color from the color map:
float4 Color = tex2D(ColorMapSampler, InTex);
// Calculate the reflection vector:
float3 R = normalize(2 * dot(InNormal, -[b]vecSunDir[/b]) * InNormal + vecSunDir);
// Calculate the speculate component:
float Specular = pow(saturate(dot(R, normalize(InViewDir))), SpecularPower) * SpecularIntensity;
// Calculate final color:
return (Ambient + Diffuse + Specular) * Color;
}