【发布时间】:2016-12-02 10:14:35
【问题描述】:
这幅画是我的 JSON 模型。
我知道我可以通过在 JSON 文件中修改 "transparent":true 和 "opacity": 0.5 来更改透明度。
但是,我想在 Three.js 场景中加载 JSON 模型后更改模型的不透明度。
我用了这个方法,但是没用.....
mesh.material.transparent = true; mesh.material.opacity = 0.1;
这是我的代码。
jsonLoader2.load("models/pic.json", addPicToScn);
function addPicToScn(geometry, material) {
var mtl = new THREE.MeshFaceMaterial(material);
var mesh = new THREE.Mesh(geometry, mtl);
mesh.scale.set(1.3, 1.3, 1.3);
mesh.material.transparent = true;
mesh.material.opacity = 0.1;
mesh.castShadow = true;
mesh.receiveShadow = true;
mesh.rotation.set(2.8*Math.PI/5, 0, -Math.PI/2);
mesh.position.set(0, 6, 21.8);
scene.add(mesh);
}
我真的很想知道这个问题的答案......
【问题讨论】:
标签: json three.js transparency opacity