我想向我的网格中添加几个位移贴图。 Like this.
但是我不知道该怎么做。
我尝试过这个。
var image = textureLoader.load('images/nail.jpg');
material = new THREE.MeshPhongMaterial({
color:0xffffff,
displacementMap: image,
displacementScale : 10,
side: THREE.DoubleSide
});
material.needsUpdate = true;
var geometry = new THREE.PlaneGeometry(30,30,30);
var plane = new THREE.Mesh(geometry, material);
scene.add(plane);
添加图片按钮源
$('#submit').click(function (){
var path = document.getElementById('file').value;
path = path.split('\\');
path = path[2];
console.log(path);
material.displacementMap = textureLoader.load('images/'+path);
});
Here's the reference site.您可以通过添加图像来查看它。