The depth is always negative between - 1 and 0,Why?
Context. Why do you need to do this? We might know a better way to accomplish your goal.
The Cesium version you’re using, your operating system and browser.
1.59
Hey, I have tried it the way he did, or not. I just found a problem. The depthTexture of postStage is viewer.scene._view.globeDepth.framebuffer.depthStencilTexture, but this depth map is used in my shader.
Float getDepth(in vec4 depth){
Float z_window = czm_unpackDepth(depth);
Z_window = czm_reverseLogDepth(z_window);
Float n_range = czm_depthRange.near;
Float f_range = czm_depthRange.far;
Return (2.0 * z_window - n_range - f_range) / (f_range - n_range);
}
Vec4 currD = texture2D(depthTexture, v_textureCoordinates);
Float depth = getDepth(currD);
The result of depth is between -1-0, the result of postStage is not like this, this is why, how can I resolve the depth map?
I have been troubled by this problem for a long time, I really hope that you can help me, why the same depth texture, the same fragment shader code, the depth of the parsing is not the same, I think it is the same depth texture, because I assigned the depth map to the front of PostProcessStage in the source code and passed it to my custom command. The depth of the PostProcessStage parsing is correct. The result of my custom command parsing is between -1-0. Why is this?