I want some special process on depth test. First of all, I want to know the correct depth calculation in shader by self instead of GPU depth test.
If I disable depth test, and write depth buffer to achieve same effect as depth test:
Pixel Shader:
void main(void) {
float depth = (position.z / position.w + 1.0) * 0.5
gl_FragColor = vec4(depth, depth, depth, 1.0);
}
It's correct implement? And how about the different depth length? (depth16 or depth24)