Hi bros,
I’ve just got a very strange problem. The upper of my bed model goes black when I zoom model out. This problem occurs after I set the side attribute to THREE.doubleSide
as a THREE.MeshPhongMaterial
. I cannot set side back to single. THREE.doubleSide
is a must for my other models. I’ve tested lights, but nothing changed. Is there any other way that I can figure out such a problem? cheers.
model upper:
after zoom out:
my code:
const loader: OBJLoader = new OBJLoader(manager);
const texture = textureLoader.load(textureUrl, function () {
// setloadingTexturePercent((index + 1) * 100 / length)
}, function () { }, function () { });loader.load(objUrl, function (object) {
if (CURRENT_ONLY_RENDER_ID !== productId) {
updating = false
return
}
object.traverse(function (child) {
if (child instanceof THREE.Mesh) {
child.material = new THREE.MeshPhongMaterial({ map: texture, side: THREE.DoubleSide })
child.material.needsUpdate = true
child.material.transparent = true
}
});
…
…
},…)
lights:
public static initLights(scene: THREE.Scene) {
const light = new THREE.DirectionalLight(0xffffff);
light.intensity = 0.6
light.position.set(1, 1, 1);
scene.add(light);
const light2 = new THREE.DirectionalLight(0xffffff);
light2.intensity = 0.6
light2.position.set(-1, -1, -1);
scene.add(light2);
var ambientLight = new THREE.AmbientLight(0xcccccc, 0.6);
scene.add(ambientLight);
}