Original Post
Hi, How can I get the depth of a fragment in a scene inside a fragment shader? I tried using WPOS semantic but when I set the wpos.z value as the red component of the output color i always get red as the output color. Where am I going wrong.
pixelOutput(float4 color : COLOR, float4 pos : WPOS);
{
pixelOutput OUT;
OUT.color.xyz = float3(pos.z, 0.0, 0.0);
return OUT;
}