如何在Three.js中平滑.obj

时间:2017-02-18 00:56:24

标签: three.js .obj

有没有办法在three.js中平滑.OBJ?我已经加载了模型,但看起来很像

我已经使用了阴影:THREE.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);
});

0 个答案:

没有答案