Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Shader doesn't appear to be working..  (Read 821 times)

0 Members and 1 Guest are viewing this topic.
Shader doesn't appear to be working..
« on: January 24, 2009, 07:30:57 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
Code: [Select]
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.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.052 seconds with 36 queries.

anything