1
$\begingroup$

The idea is to recreate the icosphere with triangle objects for further animation.

$\endgroup$
  • 1
    $\begingroup$ Do you want each triangle as a independient triangle??? $\endgroup$ – yhoyo Feb 19 '16 at 13:15
  • $\begingroup$ Yes, that´s the idea $\endgroup$ – Jorge Losilla Martínez Feb 19 '16 at 13:25
3
$\begingroup$

This here is maybe not the fastest method but it is quite easy to implement:

enter image description here

You see it already takes more than 8ms, maybe it would be good to "bake" the triangle objects before you continue to work on your animation. To do that you can eg copy all the objects and remove the node tree afterwards. Alternatively you can also go into the advanced settings of the Object Instancer node and click on "Unlink Instances from Node" and remove the node tree then.

$\endgroup$
  • $\begingroup$ That´s really the easiest way. Withouth going into geometric calculations. Thanks Jacques $\endgroup$ – Jorge Losilla Martínez Feb 19 '16 at 22:37
3
$\begingroup$

The first answer (Jacques) is right and the most natural/ immediate to Animation Nodes logic.

Still, let's make extra variants and a comparison in speed.


  1. each polygon to mesh to object, just like the first example
  2. same, but using poly indices and not the polygon data
  3. same, but use combine mesh instead of poly yo mesh

  4. instance a triangle obj and just set vertex positions (move existing verts) like the triangles

all variations have an extra move poly to origin/ move object instance back (so that we have obj centers in the poly centers), so we add more operations to stress my computer in hope to make it slower so maybe the times will differ more


setups and conclusions:

variant 1, poly to mesh to obj:

  • time 9-10 mil sec on my computer
  • the instancer blanc object vs a copy of an obj does not matter (to speed)
  • [poly info],[transform poly] and [setting to mesh]/[mesh to obj] are the specific nodes

enter image description here

variant 2, same, but poly indices:

  • time 9-10 mil sec on my computer
  • I avoid polygons and do the job manually with indices
  • [transform vert list] and [combine mesh]+ extra loop to extract verts/poly are the specific nodes

enter image description here

variant 3, same, but combine mesh:

  • time 8-9 mil sec on my computer
  • the instancer blanc object vs a copy of an obj does not matter (to speed)
  • [poly info],[transform vert list] and [combine mesh] are the specific nodes

enter image description here

variant 4, instance a triangle obj, move it's verts

  • time 2-3 mil sec on my computer
  • the instancer etc does same, not matter (to speed)
  • [transform vert list] and [set verts on obj] are the specific nodes

enter image description here


Ok, jumping to conclusions:

  • there is a slight, very little improvement where I replace poly to mesh with combine mesh
  • I lose that when I extract manually instead of poly info,
  • the significant speedup goes when moving verts instead of creating them

My wild guess is that

  • move verts [set verts on obj] is using foreach_set that is way faster than looping /creating new mesh data
  • the rest does not seam to vary time that much
  • the extra operations don't add much (try wiothout)

ps: moving the verts allows to do extra tricks if the case, like morphing a quad or ngon to the triangles

$\endgroup$
2
$\begingroup$

you can use this code... just 1 click

import bpy

sub = 2 #ICO SPHERE SUBDIVISION 
sz = 1 # ICO SPHERE SIZE
edit_mode=True #ICO SPHERE INTO EDIT_MODE


ops = bpy.ops

ops.mesh.primitive_ico_sphere_add(subdivisions=sub,
                                      size=sz,
                                      view_align=False, 
                                      enter_editmode=edit_mode)


ops.mesh.edge_split()
ops.mesh.separate(type='LOOSE')
ops.object.mode_set(mode = 'OBJECT')
ops.object.origin_set(type='ORIGIN_GEOMETRY')

icosphere script

$\endgroup$
  • $\begingroup$ This is also a great way to do it. But it´s not done within AN $\endgroup$ – Jorge Losilla Martínez Feb 20 '16 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.