Skip to content Skip to sidebar Skip to footer

Computevertexnormals Doesn't Work With Model From Jsonloader

Model always display in FlatShading even when I already have computeVertexNormals. Model is exported without normal for optimize purpose, loaded in 3JS by JsonLoader, and converted

Solution 1:

The method

bufferGeometry.fromGeometry( geometry );

returns non-indexed BufferGeometry.

Also known as "triangle soup", non-indexed BufferGeometry has no shared vertices, so computeVertexNormals() sets all vertex normals to be the same as the face normal.

In your case, you need to call computeVertexNormals() on your original geometry -- before converting to BufferGeometry:

model.geometry.computeVertexNormals();

var bufferGeometry = new THREE.BufferGeometry();

bufferGeometry.fromGeometry( model.geometry );

updated fiddle: http://jsfiddle.net/2w9Lkjbm/8/

three.js r.85

Post a Comment for "Computevertexnormals Doesn't Work With Model From Jsonloader"