gl.enable(gl.DEPTH_TEST) // Enable depth testing
gl.DepthMask(false) // Deep write for FASle does not participate in deep testing
gl.enable(gl.BLEND); / / fusion
gl.blendFunc( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA ); // Do not perform deep fusion
Copy the code
depthBuffer.setMask( material.depthWrite );
setMask: function ( depthMask ) {
        if ( currentDepthMask !== depthMask && ! locked ) {
                gl.depthMask( depthMask );
                currentDepthMask = depthMask;
        }
},
Copy the code
  • When rendering translucent objects, turn on depth testing and turn off depth write. The reason is that if you don’t write depth, the later models don’t need to consider the translucent depth test
  • The depth test is false, which means that the drawcall object is constantly overlaid