ThreeJS:纹理看起来部分平坦

时间:2013-05-08 15:22:06

标签: three.js

这是一个测试页面 http://www.aleaweb.com/3D/

正如你所看到的那样,这本书在书脊上有一个皮革纹理,在正面和背面都有一个平面颜色,但它是一个单一的物体,你知道为什么纹理被错误地应用了吗?它与建模或javascript编程有关吗?

这是关于这本书的一段代码

var texture2 = THREE.ImageUtils.loadTexture( "textures/pelle.jpg");
texture2.wrapS = THREE.ClampToEdgeWrapping;
texture2.wrapT = THREE.ClampToEdgeWrapping;
texture2.needsUpdate = true;
texture2.repeat.set( 1, 1 );
texture2.anisotropy = maxAnisotropy;
//var material = new THREE.MeshPhongMaterial({ color: 0xeeeeee, map:texture2, shininess: 100, bumpMap: texture2, bumpScale: 2, metal:false  });
var materialArray = [];

materialArray.push(new THREE.MeshBasicMaterial( { color: 0xFFFFFF }));
materialArray.push(new THREE.MeshPhongMaterial( { map: textureB }));
materialArray.push(new THREE.MeshPhongMaterial( { map: texture2, bumpMap:texture2 }));
var DiceBlueMaterial = new THREE.MeshFaceMaterial(materialArray);

var loader = new THREE.JSONLoader();
loader.load( "js/libro2.js", function ( geometry, materials ) { createScene( geometry, materials, 0.2 ) });
// draw!
function createScene( geometry, materials, scale ) {

    zmesh = new THREE.Mesh( geometry, DiceBlueMaterial );
    zmesh.position.set( -50, -50, 100 );
    //zmesh.rotation.set( 0, 0, 0 );
    zmesh.rotation.set( 90 * Math.PI / 180, 0, 30 * Math.PI / 180 );
    zmesh.scale.set( scale, scale, scale );
    zmesh.castShadow = true;
    zmesh.receiveShadow = true;
    scene.add( zmesh );
    scene.add( sphere );

    animate();
    //renderer.render(scene, camera);
}

很抱歉,如果这是一个非常新手的问题,但我无法弄清楚!

0 个答案:

没有答案