我想对齐材料,使它看起来像一块木头而不是几块。 [一块木头] [1]
如何旋转纹理/材质来执行此操作。或者我可以将此object3d设置为材质而不是每个单独的几何图形吗?
谢谢。
我试过这个,但没有运气! 随机颜色的图像加载。
var material;
var loader = new THREE.TextureLoader;
var onLoad = function(_texture) {
var imgWidth = imgHeight = 128;
var mapCanvas = document.createElement( 'canvas' );
mapCanvas.width = mapCanvas.height = 128;
// document.body.appendChild( mapCanvas );
var ctx = mapCanvas.getContext( '2d' );
var img = new Image;
img.onload = function() {
ctx.translate( imgWidth / 2, imgHeight / 2 );
ctx.rotate( Math.PI / 4 );
ctx.translate( -imgWidth / 2, -imgHeight / 2 );
ctx.drawImage( img, 0, 0, imgWidth, imgHeight );
}
img.src = 'http://remote.plancher2000.com:82/1-2-2-5-Bois.jpg';
var texture = new THREE.Texture( mapCanvas );
texture.needsUpdate = true;
material = new THREE.MeshBasicMaterial({map : texture, side:THREE.DoubleSide});
material.needsUpdate = true;
};
...
mesh[no] = new THREE.Mesh( geometry, material );
loader.load(image, onLoad, onProgress, onError);
答案 0 :(得分:1)
缺少UV。
"S", "T", "A", "T", "I", "S", "T", "I", "C", "S"