Cube border sawtooth

Hello community, this is my codepen, I am using uv to add a border to the cube, but from a distance, the border will be intermittent and there are jagged, I want to know what is wrong with my shader code, or uv this solution is wrong to implement border

I would use this approach to set a border for rectangular shapes: Anti-Aliased Grid Shader - Made by Evan


Thank you very much. After using the method in the information you provided, the effect seems to be much better, although there are still some defects

Try to instantiate the renderer this way:
var renderer = new THREE.WebGLRenderer({ canvas, antialias: true });

oh, yeah, I keep forgetting this parameter in my examples