1

screenshot

model loaded via STLLoader avalaible in THREE.js repo at github loads models into THREE.BufferGeometry with face normals computed in that painful way. geometry.computeFaceNormals() does not make any difference

model.traverse(function (child) {
            if (child instanceof THREE.Mesh) {
                child.geometry.computeVertexNormals();
            }
        });
        model.traverse(function (child) {
            if (child instanceof THREE.Mesh) {
                child.geometry.computeFaceNormals();
            }
        });

, same with changing THREE.Smooth/FlatShading.

How to make loaded models smoother? Shaders, remap normals?

Zydnar
  • 1,472
  • 18
  • 27
  • 1
    You have provided no information about your model, so one can only guess at a solution. If the loaded geometry is of type `THREE.Geometry` (or you convert it to that type), then you can try calling `geometry.mergeVertices()` prior to calling `geometry.computeVertexNormals()`. – WestLangley Aug 27 '16 at 17:49
  • @WestLangley ".mergeVertices () Checks for duplicate vertices using hashmap. Duplicated vertices are removed and faces' vertices are updated. " How it can help? But firs time first - if I use Geometry instead BufferGeometry it is not efficient with models with more triangles. I told I load it via STLLoader , and it's THREE.BufferGeometry `loader = new THREE.STLLoader(); var file = 'ring.stl'; loader.load( file, addModel ) function addModel(geometry) { model = new THREE.Mesh(geometry, material); }` Where material doesn't matter because it works smooth on buil-in geometries. – Zydnar Aug 28 '16 at 17:21
  • I want only know what to do after loading to make it look smoother. And which way is the best. I just feel it should be someting with anisotropic rendering and done by shaders. – Zydnar Aug 28 '16 at 18:53
  • I didn't noticed it's duplicated question: http://stackoverflow.com/questions/35136282/how-to-smooth-mesh-triangles-in-stl-loaded-buffergeometry – Zydnar Aug 29 '16 at 09:44
  • @WestLangley Then I simply convert it back to buffer geometry via .fromGeometry(geometry) - and now I have more fps's and smooth model, thanks! – Zydnar Aug 29 '16 at 10:39
  • Possible duplicate of [How to smooth mesh triangles in STL loaded BufferGeometry](https://stackoverflow.com/questions/35136282/how-to-smooth-mesh-triangles-in-stl-loaded-buffergeometry) – Zydnar Jun 08 '18 at 15:40

0 Answers0