Meshes transparency

When you set visibility < 1, the mesh is flagged to need alpha blending (which is expected).

However, you can’t have both alpha testing AND alpha blending enabled at the same time because of this in the Material class:

protected _shouldTurnAlphaTestOn(mesh: AbstractMesh): boolean {
    return (!this.needAlphaBlendingForMesh(mesh) && this.needAlphaTesting());
}

I don’t know why one could not have both alpha testing and alpha blending enabled, as it seems legitimate to me… @Deltakosh or @sebavan ?

So, as a hack, you can overload _shouldTurnAlphaTestOn on your material by:

mat._shouldTurnAlphaTestOn = (mesh) => mat.needAlphaTesting();

https://playground.babylonjs.com/#68RZKR#1