I’ve achieved similar results in the past.

Rewrite `EdgeRenderer`

’s algorithm, put edge visibility info into new vertex data.

one triangle face has three vertexs v0, v1, v2 and three edges, e01, e12, e20.

e01: v0 → v1

e12: v1 → v2

e20: v2 → v0

new vertex data is vector3, storing e01, e12, e20 is visible or invisible. 1 is visible, 0 is insible.

three vertexs in one triangle share same edges visibility info, so have same new vertex data.

new verte data: new Vector3(e01Visibility, e12Visibility, e20Visibility);

then use new vertex data in material plugin, renders visible wireframes using a method based on the coordinates of the center of gravity, you can refer to `meshDebugPluginMaterial.ts`

in babylon source code.

the vertex shader code as follow:

```
CUSTOM_VERTEX_DEFINITIONS: `
attribute vec3 edgesVisibility; // new vertex data
varying vec3 v_wireframeBarycentric;
`,
CUSTOM_VERTEX_MAIN_END: `
float wireframeVertexIndex = mod(float(gl_VertexID), 3.);
if (wireframeVertexIndex == 0.0) {
v_wireframeBarycentric = vec3(1.,0.,0.);
} else if (wireframeVertexIndex == 1.0) {
v_wireframeBarycentric = vec3(0.,1.,0.);
} else {
v_wireframeBarycentric = vec3(0.,0.,1.);
}
// hide invisible edges
if(edgesVisibility.y < 1.0) {
// e12 edge is invisible
v_wireframeBarycentric.x = 1.0;
}
if(edgesVisibility.z < 1.0) {
// e20 edge is invisible
v_wireframeBarycentric.y = 1.0;
}
if(edgesVisibility.x < 1.0) {
// e01 edge is invisible
v_wireframeBarycentric.z = 1.0;
}
`,
```