I am working on a tunnel project that involves a rotating texture and alpha map. My goal is to adjust the opacity of the alpha map using tweening effects.
Initially, I set the opacity to 0 and then try to increase it gradually. However, the live view does not reflect these changes even though the opacity property is being updated. It seems to be stuck at full opacity in the live view. I attempted to set the needsUpdate property of the material to true, but that did not solve the issue.
Below is how the setup looks like...
function addTunnel(){
var cylTexture = loader.load("wormhole.jpg"),
cylAlpha = loader.load("wormholeAlpha2.jpg");
cylTexture.wrapT = THREE.RepeatWrapping;
cylTexture.wrapS = THREE.RepeatWrapping;
cylAlpha.wrapT = THREE.RepeatWrapping;
cylAlpha.wrapS = THREE.RepeatWrapping;
var cylGeom = new THREE.CylinderGeometry(5000, 5000, 50000, 32, 32, true),
cylMat = new THREE.MeshPhongMaterial({
side: THREE.BackSide,
map: cylTexture,
alphaMap: cylAlpha,
transparent: true
}),
cyl = new THREE.Mesh(cylGeom, cylMat);
cyl.name = "tunnel";
scene.add(cyl);
scene.getObjectByName("tunnel").position.z= -9000;
rotateObject(scene.getObjectByName("tunnel"), -90, 0, 0);
octree.add(scene.getObjectByName("tunnel"));
tunnel = scene.getObjectByName("tunnel");
tunnel.material.alphaMap.opacity = 0;
}