How to smooth an OBJ with threejs?


I understand there are ways to smooth OBJs in blender/etc.

But, is there any way to do it with just threejs?

Things to try:

  • mesh.material.flatShading = false
  • mesh.geometry.computeVertexNormals()
  • If neither of the above works, you may need to merge vertices. THREE.BufferGeometry doesn’t implement this yet unfortunately, so you’d need to convert the mesh geometry to THREE.Geometry, merge, then optionally convert back to BufferGeometry.
1 Like

Thanks for the response. Gave it a go!

mesh.material.flatShading = false
nope :((

nope :((

“convert the mesh geometry to THREE.Geometry , merge, then optionally convert back to BufferGeometry”.
^ how would one do such magic?

here is the geo:

I believe it should be:

var a = new THREE.Geometry().fromBufferGeometry( mesh.geometry );
mesh.geometry.fromGeometry( a );

see three.js docs for details. :slight_smile:

1 Like

Sadly no luck :((
Does this look correct?

		object.traverse( function ( child ) {
			if ( child instanceof THREE.Object3D ) {
				if(child.geometry !== undefined){ 

					console.log("~ geometry ~");

					var a = new THREE.Geometry().fromBufferGeometry( child.geometry );
					child.geometry.fromGeometry( a );

					console.log("~ smooth geometry ~");


No errors, but no effect? Combining that with the other two suggestions above may help. Otherwise, are you able to create a demo?

There is one other way that you can do the smoothing.

Just like you would do a subdivision in any 3d modelling application, you can do it in threejs as well using subdivision modifier.

Here’s an example

1 Like


^ demo

Hi @fuzzy_wobble,

your OBJ model does not define any normals and has many identical vertices defined more than once. If you use OBJLoader2 with setUseIndices( true ) it removes identical vertices along and it computes vertexNormals if they are not defined afterwards, then the ballon_dog looks as follows:
OBJLoader2 identified 6873 multiple vertex definitions.

As I understand it, geometry.mergeVertices() + geometry.computeVertexNormals() should have the same effect. Did you try both together with OBJLoader?



looks fine and it works for me.

Since the support for THREE.Geometry is completly removed in v125 the accepted solution is broken.
As THREE.Geometry is deprecated it seems there is no built in future-proof implementation to achieve this ? Or is planned to get the THREE.Geometry-related methods implemented in THREE.BufferGeometry ?

If you refer to the mergeVertices you can use BufferGeometryUtils.mergeVertices(geometry), see docs