即使我已经有了computeVertexNormals,模型也始终显示在FlatShading中。模型以非法线导出进行优化,通过JsonLoader加载到3JS中,并转换为BufferGeometry。
Material 已经是SmoothShading
。请参阅此 jsFiddle 以获得更好的演示:http://jsfiddle.net/2w9Lkjbm/6/
最佳答案
方法
bufferGeometry.fromGeometry( geometry );
返回非索引的BufferGeometry
。
也称为“三 Angular 汤”,非索引 BufferGeometry
没有共享顶点,因此 computeVertexNormals()
将所有顶点法线设置为与面法线相同.
就您而言,您需要在原始几何图形上调用 computeVertexNormals()
-- 在转换为 BufferGeometry
之前:
model.geometry.computeVertexNormals();
var bufferGeometry = new THREE.BufferGeometry();
bufferGeometry.fromGeometry( model.geometry );
更新了 fiddle :http://jsfiddle.net/2w9Lkjbm/8/
三.js r.85
关于javascript - computeVertexNormals 不适用于 JsonLoader 中的模型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43624693/