.This is original scene,test scene.
Here’s code used to visualize depth buffer of the scene. it doesn’t matter, even not depth-linear.
float4 pixel_shader (custom_type ps) : SV_TARGET
{
float d = tex2D(_CameraDepthTexture,ps.screen.xy).r; //non-linear distribution
if(d < 0.00001) // almost 0
return float4(1,0,0,1);
else if( d < 0.005)
return float4(1,1,0,1);
else if(d < 0.01)
return float4(0,1,0,1);
else if(d < 0.02)
return float4(0,0,1,1);
else if(d < 0.03)
return float4(0,1,1,1);
else
return float4(d,d,d,1);
}
The resulting frame is: . the above code draw red fragment according to the first “if” condition statement.it indicate such area of no solid geometry drawing on is almost zero(black),instead of 1 (white) i was expecting.
To the best of my knowledge, with depth test function LessEqual as default setting,it should be 1(maximum),from back to front.so that’s the right thing to do in a depth test.but it consist with zero,did i make something wrong?