Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Three.js中平滑.obj_Three.js_.obj - Fatal编程技术网

如何在Three.js中平滑.obj

如何在Three.js中平滑.obj,three.js,.obj,Three.js,.obj,有没有办法在three.js中平滑.OBJ?我已经加载了模型,但它看起来是分面的 我已经在材质中使用了着色:3.SmoothShading,但不影响它 var Loader = new THREE.OBJLoader(); Loader.load('models/stockcarchasisc.obj', function(carGeo, materials) { // var material = new THREE.MeshFaceMaterial(materials); var m

有没有办法在three.js中平滑.OBJ?我已经加载了模型,但它看起来是分面的

我已经在材质中使用了着色:3.SmoothShading,但不影响它

var Loader = new THREE.OBJLoader();
Loader.load('models/stockcarchasisc.obj', function(carGeo, materials) {   

// var material = new THREE.MeshFaceMaterial(materials);
var map = new THREE.TextureLoader().load( "models/st_tex.jpg" );
map.wrapS = map.wrapT = THREE.RepeatWrapping; // This set/place UV coordinates at 0 ! 
var material2 = new THREE.MeshStandardMaterial({ 
color: 0xa65e00,
side: THREE.DoubleSide,
map: map,    
});
carGeo.traverse( function(child) {
if (child instanceof THREE.Mesh) {

// apply custom material
child.material = material2;
// enable casting shadows
child.castShadow = true;
child.receiveShadow = true;
}
});
carGeo.position.y = 25;
carGeo.scale.set(25, 25, 25);
var helper = new THREE.VertexNormalsHelper( carGeo, 5, 0x00ff00, 5 );
scene.add(carGeo);
scene.add(helper);
});

模型有顶点法线吗?应该有!有什么方法可以确定吗?我将代码粘贴到原始问题中,已经添加了辅助对象,但没有看到任何法线