Jump to content
  • Advertisement
Sign in to follow this  

Pixel shader 3.0 : VPOS

This topic is 2569 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

Hi guys.
I have a screen full-screen quad. I render it using D3DFVF_XYZRHW and a triangle fan. My vertices look like this

X, Y, Z , U , V

0 ,0 , 1 , 0, 0
800, 0 , 1 , 1, 0
800,600,1 , 1 , 1
0 ,600 , 1, 0 , 1

I render the fullscreen quad like so :

DrawPrimitice(D3DPT_TRIANGLEFAN , etc... )

And here the problem begins..
In the pixel shader, I use the texture coordinates of the quad vertices to sample my deferred shading G-buffer render targets, normals, positions etc.
float3 normal = tex2D(NormalSampler , in.vTextureCoordinates) ;
That part works fine.
However, if I try to use the shader model 3.0(and up) VPOS as texture coordinate, I get wrong results.
If I do
float4 pixelShader(in float2 screenPos : VPOS)
float3 normal = tex2D(NormalSampler , screenPos * (1.0f / 800 , 1.0f / 600)) ;


It doesn't work.
Rendering the two variants texture coordinates to screen showed eqaul results. I mean it seems that texture coordinates from the two variants are equal -
upperLeft corner - black
upperRight corner - red
lowerleft corner - green
lowerRight corner - yellow

What am I missing..Is it something about the traingle fans I use to render the fullscreen quad ?

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!