HLSL 的问题!
我在调用hlsl 的时候使用的effect object,但是在调用pixel shader 的时候我希望可以用到position的数据,可是系统提示我 这是一个错误的sementic调用,但是我看见一些例子上面都有用到的, 我不知道是什么原因请高手可以给一个提示!
下面是fx 代码, 其实什么都没有用到,就是测试学习用的>
//--------------------------------------------------------------------------------------
// Global variables
//--------------------------------------------------------------------------------------
uniform float g_fTime; // App's time in seconds
uniform float4x4 g_mWorld; // World matrix for object
uniform float4x4 g_mWorldViewProjection; // World * View * Projection matrix
uniform float g_test;
uniform texture g_NormalSceneTexture;// < string name = "cellwall.jpg"; >;
uniform texture g_VerticesTexture; // texture for all the vertices used in ambient occlusion calculation
uniform float4 g_fLightDir = { 1.25, 1.25 , 1.25, 0.0 }; // light direction
sampler g_sampleNormal =
sampler_state
{
Texture = <g_NormalSceneTexture>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Point;
};
sampler g_sampleVertices =
sampler_state
{
Texture = <g_VerticesTexture>;
MinFilter = Linear;
MagFilter = Linear;
MipFilter = Point;
};
struct VS_INPUT
{
float4 position: POSITION;
float2 Tex : TEXCOORD0;
float4 normal : NORMAL;
float4 Color : COLOR0;
};
struct VS_OUTPUT
{
float4 position : POSITION;
float4 color : COLOR;
float2 Tex : TEXCOORD0;
float2 texVetices : TEXCOORD1;
};
VS_OUTPUT VertScene( in VS_INPUT _in )
{
VS_OUTPUT output = (VS_OUTPUT)0;
output.position = mul( _in.position, g_mWorldViewProjection);
output.Tex = _in.Tex;
//output.normal = _in.normal;
return output;
}
float4 PixScene( VS_OUTPUT o ) : COLOR0
{
float4 returnColor;
//returnColor = tex2D( g_sampleNormal , o.Tex);
returnColor = tex2D( g_sampleVertices, o.Tex);
//returnColor = mul( returnColor, 500 );
//returnColor = mul( tex2D( g_verScene, o.Tex), returnColor);
return returnColor;
}
//--------------------------------------------------------------------------------------
// Techniques
//--------------------------------------------------------------------------------------
technique RenderScene
{
pass P0
{
VertexShader = compile vs_3_0 VertScene();
PixelShader = compile ps_3_0 PixScene();
}
}

