Points transparent textures depth artifacts (soft particles)

It’s gl_FragCoord.z. It think it makes sense to linearize this value and the value from the depth map if you are going to compare them. You can do this by including the packing chunk into your shader and then do this:

#include <packing>

float getLinearDepth( fragCoordZ ) {

    float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );
    return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );

}

The following example uses this code: three.js webgl - Depth Texture

As you can see, you need to pass in cameraNear and cameraFar as uniforms to the shader.