Threejs如何改变材质的颜色

时间:2017-04-05 21:48:32

标签: three.js

我有一个带有简单平面的threejs场景,以及在平面材质上加载的黑白png地图。我想要做的是更改地图的颜色而不影响场景中的任何其他网格。对此有什么想法吗?我的代码片段很震撼:

                var plane = new THREE.PlaneGeometry(foilWidth, foilHeight);
                var mat = new THREE.MeshPhongMaterial();
                var texloader = new THREE.TextureLoader();
                mat.map = texloader.load(modelOptions.foil);
                mat.color = new THREE.Color(0xff0000); // works is the map is not given
                mat.transparent = false;
                mat.needsUpdate = true;
                mat.transparent = true;
                mat.side = THREE.DoubleSide;
                mat.depthWrite = true;
                mat.needsUpdate = true;

                let foil = new THREE.Mesh(plane, mat);
                scene.add(foil);

0 个答案:

没有答案