Isilmë O.
Isilmë O.

Reputation: 1746

Smooth shading not working for OBJ loaded in Three.js scene

That is, the OBJ looks smooth in my 3D modeling software while looks quirky (triangular) in Three.js scene. I assign MeshLambertMaterial to it. According to the documentation, the default shading for that material is THREE.SmoothShading. Even if I set it manually and check through the debugging console the "shading" property is properly set, the model in the scene still does not look smooth.

Upvotes: 1

Views: 2607

Answers (1)

Sebastian Baltes
Sebastian Baltes

Reputation: 512

The VertexNormals are not calculated by the OBJ(MTL)Loader. You can calculate them afterwards (haven't tested):

my3dObject.traverse( function( node ) {
    if ( node instanceof THREE.Mesh ) {
        node.geometry.computeVertexNormals(); 
    }
} );

Upvotes: 4

Related Questions