threejs之載入stl模型
阿新 • • 發佈:2020-12-08
threejs之載入stl模型
loader.load(`/gltf/RMHospital.stl`, geometry => { // var material2 = new THREE.MeshLambertMaterial( { color: 0x00ff00} ); let material = new THREE.MeshPhongMaterial({ color: '#013cff', opacity:1, transparent: true }) let mesh = new THREE.Mesh(geometry, material) mesh.position.x = 0; mesh.position.y = 0; mesh.position.z = 0; mesh.scale.set(0.4,0.4,0.4); // mesh.scale.set(1,1,2.5); mesh.rotation.set(-1.54,0,0); group.add(mesh); })
材質:
1.純色材質
var material = new THREE.MeshLambertMaterial( { color: 0x00ff00} );
2.邊框材質
let material3 = new THREE.MeshBasicMaterial( { color:'#749eff', opacity: 0.1, wireframeLinejoin: 'miter', wireframe: true } )
3.png透明材質(transparent設定為true)
var material = new THREE.MeshPhongMaterial({ map: THREE.ImageUtils.loadTexture("/image/light2.png"), transparent: true });
鑽研不易,轉載請註明出處。。。。。。