0

I want to separate each face of icosahedron as shown in above image. Can anybody point me to related example or any idea about making it work.In my example icosahedron each face has different image texture as a material so i cannot use Shadermaterial.

image

Thanks

1 Answers1

2

You can use ExplodeModifier to convert your geometry into so-called "triangle soup", and then translate the vertices as you wish.

var geometry = new THREE.IcosahedronGeometry( 4, 2 );

var modifier = new THREE.ExplodeModifier();
modifier.modify( geometry );

var normal = new THREE.Vector3();

for ( var i = 0, l = geometry.faces.length; i < l; i ++ ) {

    var face = geometry.faces[ i ];

    normal.copy( face.normal ).multiplyScalar( 1 );

    geometry.vertices[ face.a ].add( normal );
    geometry.vertices[ face.b ].add( normal );
    geometry.vertices[ face.c ].add( normal );

};

examples/js/modifiers/ExplodeModifier.js must be explicitly included in your project.

three.js r.87

WestLangley
  • 92,014
  • 9
  • 230
  • 236