   Pixel position as a texture look up
  Hello,I am attempting to use the current pixel's screen space position in a shader as a look-up into an alpha mask texture to determine the alpha value that this pixel should use.In the vertex shader, I store the same value that is calculated for the POSITION register in a TEXCOORD register, so I can operate on it in the pixel shader.In the pixel shader, there is the following code:float2 alphaTexCoord = In.screenPosition.xy / In.screenPosition.w;alphaTexCoord += float2( 1.0f, 1.0f );alphaTexCoord *= float2( 0.5f, 0.5f );alphaTexCoord.y = 1.0f - alphaTexCoord.y;float alpha = tex2D( AlphaMask, alphaTexCoord ).a;Does this look correct? It is almost working, but the values seem to be coming out slightly off. Am I missing a subtraction of ( 0.5f, 0.5f ) for the typical pixel offset?Thanks,Eric   
  Indeed, you are missing the half-texel offset.  Here is the function I use:float2 CalcSSTexCoord (float4 vPositionCS){    float2 vSSTexCoord = vPositionCS.xy / vPositionCS.w;    vSSTexCoord = vSSTexCoord * 0.5f + 0.5f;   vSSTexCoord.y = 1.0f - vSSTexCoord.y;vSSTexCoord += 0.5f / g_vRTDimensions;   return vSSTexCoord;}   g_vRTDimensions is the dimensions of the render target.   