0
$\begingroup$

In a previous, excellent answer it was proposed that it might be helpful to subdivide some triangles in my mesh at certain times during the animation to prevent them from overlapping adjacent faces when the mesh is very highly distorted. It's best to look at the question and answer there now.

OK you're back. The trajectory of the ~10,000 vertices of the original icosphere mesh are pre-calculated and stored in a NumPy array. A "badness" detector could search for highly stretched edges, but then what? If it inserted real vertices, I think it might be tricky to try to remove them later, and keep the rest lined up with NumPy. I could try to figure out a way to script that, but I wonder if there might be other ways, or possibly something existing in Blender already?

I am re-linking @TLousky 's image here:

https://blender.stackexchange.com/a/38104/5334

$\endgroup$
6
  • 1
    $\begingroup$ you warp this mesh so much that the points that where previously beside each-other are no longer neighbours, so while the topology is still valid.. it produces that wacky result. I think you might investigate how to triangulate this mesh using something like: n-e-r-v-o-u-s.com/blog/?p=3093 "Ball-Pivot algorithm" $\endgroup$
    – zeffii
    Commented Sep 6, 2015 at 14:30
  • $\begingroup$ That's a good point @zeffii , and link. The original task (section 8.1 here ) is supposed to be challenging to visualize, and it sure is. Ultimately need to keep the icosphere's original vertices in their correct place, but adding vertices is fine. I think Blender is incredibly useful and flexible, and can do just about anything, so long as StackExchange is here too! :) $\endgroup$
    – uhoh
    Commented Sep 7, 2015 at 3:35
  • $\begingroup$ These videos are not exactly what we're talking about here @zeffii but roughly this kind of thing. $\endgroup$
    – uhoh
    Commented Sep 7, 2015 at 4:16
  • 1
    $\begingroup$ It seems the paper suggests to do the deformation first, then make a heat map of the faces relative deformation (edge, surface area), then on a fresh icoshphere apply a new subdivision with relative weights according to the heat map produced, then deform that one. might be possible. see blender.stackexchange.com/questions/29106/tesselate-a-plane $\endgroup$
    – zeffii
    Commented Sep 7, 2015 at 7:18
  • $\begingroup$ "decimation" .. not subdivision. $\endgroup$
    – zeffii
    Commented Sep 7, 2015 at 7:36

1 Answer 1

3
$\begingroup$

Well, as I originally suggested in the previous question, you can always try using the Remesh modifier. It dynamically generates a clean mesh with ~equal size quads out of the volume of your mesh.

I'd recommend using the smooth mode and an octtree depth of 7 or more to get accurate reconstruction of your mesh.

ADDED: It also helps to add a smooth modifier on top of the remesh modifier, because the mesh generated by the remesh modifier is still a but funky due to the issues with the original mesh.

enter image description here

Here's a code snippet you can add to your script:

myObject.select = True # Replace myObject with a reference to your actual mesh object
bpy.context.scene.objects.active = myObject

bpy.ops.object.modifier_add( type = 'REMESH' )
m = bpy.context.object.modifiers['Remesh']
m.mode         = 'SMOOTH'
m.octree_depth = 7

bpy.ops.object.modifier_add( type = 'SMOOTH' )
m = bpy.context.object.modifiers['Smooth']
m.iterations = 26

It's not exactly what you asked for, but might do the job nontheless.

ADDED: You only need to add this modifier once, of course (it will adapt to changes in your mesh), but it will slow down your script considerably, since the remesh modifier takes quite a bit of time to calculate, especially in the higher octtree_depth levels.

$\endgroup$
4
  • $\begingroup$ This is interesting! I'm putting it just before the i_frame loop near line 100, but so far I get an error about context (I'm just using one of the two objects) I'll check to see if it works with the key_blocking or one of the other keyfaming methods in the three answers to this question. stay tuned..... $\endgroup$
    – uhoh
    Commented Sep 6, 2015 at 13:03
  • 1
    $\begingroup$ Generally, the modifier add operator (bpy.ops.object.modifier_add), like many other object operators, needs an active object to work. Make sure to select and set one of your objects as active before running this code, and it will solve your context issue. To select use: myObject.select = True To activate use: bpy.context.scene.objects.active = myObject (with myObject being a general name for which you'll replace with your actual object reference, of course) $\endgroup$
    – TLousky
    Commented Sep 6, 2015 at 15:35
  • 1
    $\begingroup$ OK a comment is no place to put code samples, so I just updated the code block above to include the required amendment (just make sure to actually use your own object there) $\endgroup$
    – TLousky
    Commented Sep 6, 2015 at 15:39
  • 1
    $\begingroup$ Thanks! It's not 100% perfect yet, but it is a great start. It looks like I now have three parameters to play with, initial icosphere subdivisions, octree depth, and smooth iterations. Thank you @TLousky for taking the time to dig in to the script. $\endgroup$
    – uhoh
    Commented Sep 7, 2015 at 3:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .