Sign in to follow this  
PixelShader

Help:How to use the Position in Pixel Shader?

Recommended Posts

I have downloaded a Sample, which has a shader.fx. the part of ps was like this: void TextureColorV1_1( in float4 Pos : POSITION, in float2 textureCoords : TEXCOORD0, in float2 textureCoords2 : TEXCOORD1, out float4 diffuseColor : COLOR0){.....} It has "in float4 Pos : POSITION," as the first param in the sample, but haven't use it in the function body at all. I try to use Pos.y to implement my idea, but get an error says "invalid input semantic 'POSITION'". Would you like to tell me the reason and how to use it correctly? Thanks!

Share this post


Link to post
Share on other sites

If I remember correctly, the position element cannot be used. I have a vague memory that the position is accessible with SM3 level hardware.

To get around this problem, you can pass the position also as a vertex coordinate, which is accessible from the PS.

With PS1.1, if the vertex coordinate isn't used as a texture lookup, the range will be limited to [0..1]. The limit doesn't apply with PS2.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this