meshfx // GLB WELD

How to remove duplicate vertices from a GLB file

You remove real duplicate vertices from a GLB by merging by distance in your 3D editor and exporting again, and some repeated positions will remain. glTF stores one vertex per unique mix of position, normal and UV, so the exporter splits vertices at every UV seam and hard edge. Only overlapping vertices with matching data are waste.

pyrofx effects work today, and new accounts start with $5 of usage.

MODULE // meshfx AVAILABLE

meshfx measures faults, checks repairs and makes LODs for a triangle budget. meshfx runs on the hosted API: try it in the Playground.

  • glTF vertex: position plus normal, UV and more
  • Splits at seams and hard edges are needed
  • Real duplicates: same data, unconnected faces

01 // WHY

Which duplicates in a GLB are real

A GLB is indexed: triangles point into a vertex list, and each vertex carries all its attributes at once. Where two faces share a position but need different UVs or normals, the file must hold two vertices, so the GLB vertex count is always higher than the count in your 3D editor.

Real duplicates match in every attribute yet belong to faces that are not connected. They show as a crack or a shading seam where no UV seam exists.

02 // HOW TO

Merge and export a clean GLB

  1. Import the GLB into your 3D editor. If the importer offers to merge vertices, turn it on.
  2. Run Merge by Distance with a threshold near 0.0001 m, which glTF meters make easy to set.
  3. Mark sharp edges or use smooth by angle so hard corners stay crisp.
  4. Check that the UV seams are still where you want them.
  5. Export a new GLB. The exporter splits vertices again where UVs and normals require it.

meshfx measures holes, flipped faces and non-manifold edges. Each repair is checked against the source and undone with a warning if it moves the surface too far. Hosted meshfx runs are available in the Playground.

03 // CHECK

Compare vertex counts in three.js

Log the vertex count of each mesh before and after, with the GLB loaded through GLTFLoader.

count-vertices.js
gltf.scene.traverse((o) => {
  if (o.isMesh) console.log(o.name, o.geometry.attributes.position.count);
});

05 // FAQ

GLB duplicate vertex questions

All questions →

README.REMOVE_DUPLICATE_VERTICES_GLB
Why do duplicate vertices cause shading or export problems in a GLB?

Unconnected duplicates break smooth shading into seams and make the mesh count as open. They also add vertices the engine processes for nothing.

How do I merge by distance without damaging a GLB's UVs?

Merge positions in your 3D editor where UVs sit on face corners and survive the merge, keeping the threshold small.

How do I check a GLB's vertex count in three.js?

Traverse gltf.scene after GLTFLoader loads it and read geometry.attributes.position.count on each mesh.

How do I weld overlapping vertices in a GLB game model?

Merge by distance in your 3D editor and export again. A GLB has no weld setting of its own, so merge before export.

Explore meshfx outputs

Inspect compiled meshfx outputs and their reports. Hosted meshfx runs are available in the Playground.

All effects, guides and explainers →