struct VS_IN
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float2 UV : TEXCOORD0;
float3 Normal : NORMAL;
};
struct VS_OUT
{
float4 Position : POSITION0;
float4 Color : COLOR0;
float2 UV : TEXCOORD0;
};
float4x4 WorldViewProj : WorldViewProjection;
Texture2D tex;
sampler2D texSample = sampler_state
{
Texture = <tex>;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
VS_OUT mainVS(VS_IN In) : POSITION
{
VS_OUT Out;
Out.Position = mul(In.Position, WorldViewProj);
Out.Color = In.Color;
Out.Color.a = 1.0;
Out.UV = float2(0.0, 1.0);
return Out;
}
float4 mainPS(VS_OUT In) : COLOR
{
float4 color = tex2D(texSample, In.UV);
return color;
}
technique technique0 {
pass p0 {
ZEnable = true;
ZWriteEnable = true;
CullMode = None;
VertexShader = compile vs_3_0 mainVS();
PixelShader = compile ps_3_0 mainPS();
}
}
I'm trying to write a shader that simply applies a texture to an object, however it doesn't appear to be working properly and I end up with a flat shaded object.