How to create a coin from two images of the coin using three.js CylinderGeometry.?

StackOverflow https://stackoverflow.com/questions/9335693

  •  27-10-2019
  •  | 
  •  

문제

Hi thanks in advance for any help. I have two images of a coin say a head and tail of some coin. I want to create 3D coin from it using three.js. I tried a lot but could not get to the actual shape of a coin. My code is following.

mesh = new THREE.Mesh(
   new THREE.CylinderGeometry(20, 20, 0, 20, 1, false),
   new THREE.MeshBasicMaterial( { map: THREE.ImageUtils.loadTexture('coin1.png'),
                                  overdraw: true } ) );
scene.add(mesh);

Please help how can i add second image so that it is shown like a real 3D coin.

Regards

도움이 되었습니까?

해결책

I am not expert on three.js, but I assume it is the same like in others engines.

You have to create one texture containing top, edge and bottom of the coin. Then you have to map the texture on triangles of your cilinder. So you have to create your own cylinder and mappings. You can find details in Texturing a Cylinder in Three.js question.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top