I use the latest version is r144.
I load the model by new THREE.OBJLoader
.
I use child.geometry = THREE.BufferGeometryUtils.mergeVertices(child.geometry)
,but It seem not works.
How to smooth the mesh just by three.js.
child.geometry = THREE.BufferGeometryUtils.mergeVertices(child.geometry,1e-4);
child.geometry .computeVertexNormals();
or
child.geometry = THREE.BufferGeometryUtils.mergeVertices(child.geometry,1e-0);
child.geometry .computeVertexNormals();
I think maybe the .obj has some wrong, I use 1e-1
, it look like below:
I use 1e-0
, it look like below:
The second image is using too low a tolerance, and merging vertices that are not that close to each other in position.
Also consider that vertex attributes with different values (other than just position) can prevent vertices from being merged. Try deleting any unneeded attributes — particularly “normal” — if you are trying to force smooth the mesh.
geometry.deleteAttribute( 'normal ');
Thank you very much, it works.
I use
child.geometry.deleteAttribute('normal')
child.geometry = THREE.BufferGeometryUtils.mergeVertices(child.geometry)
child.geometry.computeVertexNormals()
It looks so smooth:
1 Like