I am trying to download some STL files using Three.js. Models loaded correctly, but there are too many triangles that I would like to merge / smooth.
I have successfully applied smooth loading areas in other three-dimensional formats, but I cannot do this with the BufferGeometry that occurs when loading an STL file using STLLoader.
_
var material = new THREE.MeshLambertMaterial( { ... } ); var path = "./models/budah.stl"; var loader = new THREE.STLLoader(); loader.load( path, function ( object ) { object.computeBoundingBox(); object.computeBoundingSphere(); object.computeFaceNormals(); object.computeVertexNormals(); object.normalizeNormals(); object.center();
This is what I tried, it throws an error: Dig TypeError: smooth.mergeVertices is not a function
If I comment out the line "mergeVertices ()", I get another error: Uncaught TypeError: cannot read the length of the undefined property in SubdivisionsModifier, line 156.
It looks like code examples I'm trying to deprecate (this has been happening a lot recently due to huge changes in the Three.JS library). Or maybe I'm forgetting something. The fact is that the vertices seem to be zero.?
Thanks in advance!
source share