Transparent instancedMesh rendering bug with different positions

I used the InstancedMesh.
I tried to solve the problem of wrong rendering order by setting depthWrite to true. But it caused a new problem, the transparent part will appear black.

  1. depthWrite = true;
    alphaTest = 0.02;

wrong result:

expected result:

  1. depthWrite = false;
    The black disappears, but the rendering order is wrong. Meshes close to the camera are obscured by objects far away from the camera.

Similar issue has already been discussed in: Is it possible to set varying opacity for objects inside a InstancedMesh (filled with BoxBufferGeometry + MeshPongMaterial cubes).

Unfortunately, this kind of transparency issue is hard to tackle. Setting depthWrite: false is right but you have to sort instances per frame based on their distance to the camera to improve results.

ok, thank you