Carpe Diem
Carpe Diem

Reputation: 73

3D tube one side black

I am drawing 3D tube with three.js

I am seeing one side of that tube black. Please help me for the same

Please find code at: http://jsfiddle.net/7WNZ7/ Code at above link

Upvotes: 0

Views: 332

Answers (1)

WestLangley
WestLangley

Reputation: 104803

You need to add some ambient light like so:

var light = new THREE.AmbientLight( 0x888888 );
scene.add( light );

And you need to add ambient reflectance to your material. It will also look better if the material is double-sided:

var mesh = THREE.SceneUtils.createMultiMaterialObject( geometry, 
    [new THREE.MeshLambertMaterial({
        color: color, 
        ambient: color, 
        side: THREE.DoubleSide
    }), 
    new THREE.MeshBasicMaterial({
        color: 0x000000,
        wireframe: true,
        transparent: false
    })
]);

Alternatively, you could just add more directional or point lights.

fiddle: http://jsfiddle.net/7WNZ7/1/

Upvotes: 1

Related Questions