Hi i am newbie in directx and struggling with SV_POSITION in pixel shader.
So my pixel shader get input from SV_POSITION input(float4) as normal and i just guess that the z component of this input will give me the depth value of the pixel that this shader is dealing with. So i just did some simple test.
Pixel Shader
float4 main(PS_INPUT input) : SV_Target
{
float Z = input.pos.z / input.pos.w;
if (Z<0.1f)
return RED;
...//draw texture
}
And it turns out that all obj appears RED except when i get camera really close to them. just opposite result that i expected.
So i just guess the output value of SV_POSITION in vertex shader will be differnt to input value of same semantic in pixel shader???
any advice would be appreciated.