Answer the question
In order to leave comments, you need to log in
Why does three.js only render the silhouette of the model?
Own code
function init(container,path) {
camera = new THREE.PerspectiveCamera( 20, window.innerWidth / window.innerHeight, 0.2, 2000 );
camera.position.z = 1100;
scene = new THREE.Scene();
var ambient = new THREE.AmbientLight( 0xffffff );
scene.add( ambient );
var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.1);
directionalLight.position.set( 0, 0, 1 );
scene.add( directionalLight );
var texture = THREE.ImageUtils.loadTexture('/public/texture.png');
// texture.wrapS = THREE.RepeatWrapping;
// texture.wrapT = THREE.RepeatWrapping;
var sphereMaterial = new THREE.MeshLambertMaterial({
map: texture
});
var loader = new THREE.OBJLoader();
loader.load(path, function(object) {
window.z = object;
object.children[0].material = sphereMaterial;
scene.add( object );
animate();
});
renderer = new THREE.WebGLRenderer();
renderer.setSize( 800, 600 );
container.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
render();
}
function render() {
renderer.render( scene, camera );
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question