Jump to content
  • Advertisement
Sign in to follow this  
PixelShader

Help:How to use the Position in Pixel Shader?

This topic is 4392 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 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
Advertisement

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
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!