Smooth shading on Buffergeometry

Hi,
So before three r125, it was possible to smooth the shading of a geometry (imported from Blender) this way:

const tempGeo = new THREE.Geometry().fromBufferGeometry( geometry );
tempGeo.mergeVertices();
tempGeo.computeVertexNormals();
geometry = new THREE.BufferGeometry().fromGeometry(tempGeo);

The result looked like this (left: before, right: after)

But since the Geometry class has been deprecated, I tried something like this:

geometry = BufferGeometryUtils.mergeVertices( geometry );
geometry.computeVertexNormals();


But the result (left: before, right: after) is quite different.

Is there any way to get this smooth shading back with a BufferGeometry?

Thanks!

// (1) remove vertex attributes that don’t match between colocated vertices
geometry.deleteAttribute(‘normal’); // maybe: uv, uv2, tangent, …

// (2) merge vertices
geometry = BufferGeometryUtils.mergeVertices(geometry);

// (3) compute smooth normals
geometry.computeVertexNormals();

2 Likes