Reputation: 2794
I have a tile set of terrain textures. They are all of equal sizes. It currently maps the whole image to the texture. How can I map a texture to only part of the image instead of the whole image? I know of work-arounds but I was wondering if Three.js had a built-in way of doing it.
var image = new Image();
image.onload = function () {
texture.needsUpdate = true;
};
image.src = path;
var texture = new THREE.Texture(image, new THREE.UVMapping(), THREE.ClampToEdgeWrapping, THREE.ClampToEdgeWrapping, THREE.NearestFilter, THREE.LinearMipMapLinearFilter);
return new THREE.MeshBasicMaterial({
map: texture
});
Upvotes: 0
Views: 597
Reputation: 2887
The short answer is that Three.js doesn't support it builtin when you want multiple textures on a single mesh.
The easiest way is with splitting up the mess in different parts or when you are sure to use less then 16 textures you could use a shadermaterial.
Upvotes: 1