I'm trying to create a transparent cylinder. I've tried setting transparent, opacity, etc., but can't seem to get it to work. Is there any way to do this? Do I need to load a dummy texture with an alpha channel? Is there a simpler way?
material = new THREE.MeshBasicMaterial({wireframe: true});
material.transparent = true;
mesh = new THREE.Mesh(new THREE.CylinderGeometry(4, 4, 50, 8, 1, true), material);
scene.add(mesh);
Update: I've changed the code to the following, but it seems wrong to use ShaderMaterial in this way. But it works...
material = new THREE.ShaderMaterial({wireframe: true, transparent: true});
mesh = new THREE.Mesh(new THREE.CylinderGeometry(4, 4, 50, 8, 1, true), material);
scene.add(mesh);
Update: Here are the images.
ttp://img692.imageshack.us/img692/6412/shadermaterial.png Using ShaderMaterial you see the rectangular grey Sprite surrounded by a transparent cylinder.
http://img855.imageshack.us/img855/3988/opacity00.png Using MeshBasicMaterial with Opacity 0.0.
http://img27.imageshack.us/img27/6087/opacity05.png Using MeshBasicMaterial with Opacity 0.5.
http://img837.imageshack.us/img837/8043/opacity10.png Using MeshBasicMaterial with Opacity 1.0.
Shouldn't it be this instead?
material = new THREE.MeshBasicMaterial( { wireframe: true, opacity: 0.5 } );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With