Jump to content
  • Advertisement
Sign in to follow this  
nguyen my

vertex shader and pixel shader error ?

This topic is 2827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i have this code . i write in RenderMonkey

float4x4 matViewProjection;
float4x4 matrixNormal;
float4 diffuseLight;
float4 diffuseMtr;
float3 directLight;

float4 ambientMtr;
float4 ambientLight;


texture Texture3D;

sampler Texs=sampler_state
{
texture=<Texture3D>;
MinFilter=LINEAR;
MagFilter=LINEAR;
MipFilter=LINEAR;

};

struct VS_OUTPUT
{
float4 Pos: POSITION;
float4 color: COLOR0;
float2 tex0: TEXCOORD;
};

VS_OUTPUT vs_main( float3 inPos: POSITION,float3 normal:NORMAL,float2 tex0:TEXCOORD )
{
VS_OUTPUT Out=(VS_OUTPUT)0;
float3 normalW=mul(float4(normal,0.0f),matrixNormal).xyz;
normalW=normalize(normalW);
//tinh toan as khuyech tan tre n be mat vat the
float s=max(dot(normalW,directLight),0.0f);

float3 diffuse=s*(diffuseLight*diffuseMtr).rgb;
float3 ambient=ambientLight*ambientMtr;

Out.color.rgb=diffuse+ambient;
Out.color.a=diffuseLight.a;

Out.tex0=tex0;

Out.Pos = mul(float4(inPos,1.0f),matViewProjection);
return Out;
}

and pixel shader

float4 ps_main( float4 inDiffuse: COLOR0,float2 tex0 :TEXCOORD) : COLOR0
{
// Output constant color:
float texcolor=tex2D(Texs,tex0).rgb;
float3 color=inDiffuse.rgb*c.rgb;
return float4(color,inDiffuse.a);
}

this is an error when it run
COMPILE ERROR: API(D3D) /../Default_DirectX_Effect/Pass 0/Pixel Shader/ (4): error X3004: undeclared identifier 'Texs'

i hope everyone help me


Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!