In my current scene, I have various objects, including spheres that I want to be illuminated by pink and blue lights. However, there is also a tube geometry that should only be affected by a white light, without picking up the pink and blue colors.
To illustrate the issue, here is a comparison: What is happening: https://i.sstatic.net/oWOPO.png Desired outcome for the tube: https://i.sstatic.net/YCkcC.png
Currently, I am achieving this by using a meshBasicMaterial
, but this approach compromises the 3D appearance of the tube.
How can I create a gray tube with a MeshLambertMaterial
that doesn't react to the pink and blue lights?
Below is the code snippet that outlines how I am setting up my scene:
# Generating spheres:
for (var i = 0; i < 5; i++) {
var SphereGeometry = new THREE.SphereGeometry(2, 20, 20);
var SphereMaterial = new THREE.MeshLambertMaterial({ color: 0xffffff });
var Sphere = new THREE.Mesh(SphereGeometry, SphereMaterial);
Sphere.position.set(i * 7 -14, 0 + Math.random() * 5 - 2.5, 2);
spheresArray.push(Sphere);
scene.add(Sphere);
}
#Generating tubes:
for (var i = 0; i < CurvesArray.length; i++) {
var geometry = new THREE.TubeGeometry( CurvesArray[i], 20, 0.5, 8, false );
var material = new THREE.MeshBasicMaterial( { color: 0xe3e3e3 } );
var mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
}
#Lights setup:
var spotLight = new THREE.SpotLight( 0xff00cc );
spotLight.position.set( -10, 3, 30, 100 );
lightsArray.push(spotLight);
scene.add(spotLight);
var spotLight2 = new THREE.SpotLight( 0xaa99cc );
spotLight2.position.set( 5, 15, 10, 100 );
lightsArray.push(spotLight2);
scene.add(spotLight2);
var spotLight3 = new THREE.SpotLight( 0x0022bb );
spotLight3.position.set( 2, -15, 10, 100 );
lightsArray.push(spotLight3);
scene.add(spotLight3);
var light = new THREE.AmbientLight( 0x5f5f5f );
scene.add( light );
If you need more information or find any part confusing, feel free to ask for clarification!