meshfx // OBJ WELD

How to remove duplicate vertices from an OBJ file

You remove duplicate vertices from an OBJ by merging by distance in your 3D editor and exporting again. OBJ keeps positions, UVs and normals in separate lists, so a clean file needs only one v line per corner position. Duplicates appear when an exporter writes each face or part on its own, leaving repeated v lines and cracks.

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.

  • v, vt and vn are separate indexed lists
  • One v line per position is enough
  • Repeated v lines mean unconnected faces

01 // WHY

How duplicates get into an OBJ

Each f line points to a position (v), a UV (vt) and a normal (vn) by separate numbers, as in f 1/1/1 2/2/1 3/3/1. A corner on a UV seam can therefore share its position and still use two different UVs, so OBJ never needs repeated positions. Repeated v lines come from exporters that write each part or face as its own block, from scans, and from parts joined without merging.

count-repeats.js
// objText: the OBJ file as a string; counts exact repeats only
const v = objText.split('\n').filter((l) => l.startsWith('v '));
console.log(v.length - new Set(v.map((l) => l.trim())).size, 'repeated v lines');

02 // HOW TO

Merge and export a clean OBJ

  1. Import the OBJ into your 3D editor and note the vertex count.
  2. Select all and run Merge by Distance. OBJ has no unit, so set the threshold in the file's own unit: 0.0001 for meters, 0.01 for centimeters.
  3. Set smoothing again with sharp edges or smooth by angle.
  4. Export the OBJ with UVs and normals on.
  5. Run count-repeats.js on the new file to confirm the repeated v lines are gone.

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.

04 // FAQ

OBJ duplicate vertex questions

All questions →

README.REMOVE_DUPLICATE_VERTICES_OBJ
How do I remove duplicate vertices from an OBJ file?

Merge by distance in your 3D editor and export again. Set the threshold in the file's own unit because OBJ has none.

Do duplicate vertices in an OBJ matter in three.js?

Yes. Cracks show as seams and smooth normals cannot cross them. Weld in your 3D editor or call BufferGeometryUtils.mergeVertices() after loading.

How do I remove duplicate or overlapping faces in an OBJ?

Merge vertices first so copies share the same v indices, then delete duplicate faces with your editor's cleanup.

Does Unity remove duplicate vertices when it imports an OBJ?

Partly. The Weld Vertices option merges vertices that match in position, UV and normal. Merge by distance in your 3D editor first.

Explore meshfx outputs

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

All effects, guides and explainers →