问题
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 to BufferGeometry.
Material is already SmoothShading
. Please see this jsFiddle for better demonstration: http://jsfiddle.net/2w9Lkjbm/6/
回答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
来源:https://stackoverflow.com/questions/43624693/computevertexnormals-doesnt-work-with-model-from-jsonloader