I'm looking after this for a long time now. I just can't find any solution, anywhere. I'm trying to apply 3 different textures on a cylinder (2 caps, and side) But I have absolutely no idea on how to achieve this. Can you orient me? Here's what I'm doing for now :
var coin1_geo = new THREE.CylinderGeometry( 100, 100, 10, 100, 100, false );
var coin1_texture = THREE.ImageUtils.loadTexture("./assets/avers.png");
var coin1_mat = new THREE.MeshLambertMaterial({map:coin1_texture});
var coin1 = new THREE.Mesh( coin1_geo, coin1_mat );
coin1.rotation.x = 20;
coin1.position.set(0,0,0);
coin1.castShadow = true;
coin1.receiveShadow = false;
scene.add( coin1 );
As you can see here, I only apply one texture on all faces. But even on caps, it's not really displaying, I only have a piece of the full circle. Please help, I'm achieving a coin, if you didn't figure out. Even if you just give me a link to a tutorial I would be really thanksfull. I can't find anything, and my knowledge in 3D/OpenGL programming is quite limited. Thanks a lot.
In modern Three.js you can create a cylinder with an array of 3 materials:
TypeScript function variant, that creates Object3D with 3 meshes: side, topCap and bottomCap.
Works with lib version:
"three": "0.102.1"
[edit] Three cylinders didn't work since the cap UVs are bogus. You need to roll your own cap geometries. Not a lot of work, just annoying. Here's how to do an uncapped cylinder with custom caps: