我用three.js中的NURBSSurface
绘制了表面并用图片映射了表面。我发现纹理不是均匀分布的。
我不知道该怎么做才能使纹理均匀分布。有谁知道该怎么办?非常感谢你!
// NURBS surface 2
var nsControlPoints = [
[new THREE.Vector4(-200, -200, 100, 1), new THREE.Vector4(-200, -100, -200, 1), new THREE.Vector4(-200, 100, 250, 1), new THREE.Vector4(-200, 200, -100, 1)],
[new THREE.Vector4(0, -200, 0, 1), new THREE.Vector4(0, -100, -100, 5), new THREE.Vector4(0, 100, 150, 5), new THREE.Vector4(0, 200, 0, 1)],
[new THREE.Vector4(200, -200, -100, 1), new THREE.Vector4(200, -100, 200, 1), new THREE.Vector4(200, 100, -250, 1), new THREE.Vector4(200, 200, 100, 1)]
];
var degree1 = 2;
var degree2 = 3;
var knots1 = [0, 0, 0, 1, 1, 1];
var knots2 = [0, 0, 0, 0, 1, 1, 1, 1];
var nurbsSurface = new THREE.NURBSSurface(degree1, degree2, knots1, knots2, nsControlPoints);
var map = new THREE.TextureLoader().load('textures/UV_Grid_Sm.jpg');
map.wrapS = map.wrapT = THREE.RepeatWrapping;
map.anisotropy = 16;
function getSurfacePoint(u, v, target) {
return nurbsSurface.getPoint(u, v, target);
}
var geometry = new THREE.ParametricBufferGeometry(getSurfacePoint, 20, 20);
var material = new THREE.MeshLambertMaterial({
map: map,
side: THREE.DoubleSide
});
var object = new THREE.Mesh(geometry, material);
object.position.set(-200, 100, 0);
object.scale.multiplyScalar(1);
group.add(object);