BradyAJohnston / MolecularNodes

Toolbox for molecular animations in Blender, powered by Geometry Nodes.
https://bradyajohnston.github.io/MolecularNodes/
MIT License
845 stars 83 forks source link

Feedback: Automatic Armature Creation #358

Open BradyAJohnston opened 7 months ago

BradyAJohnston commented 7 months ago

In 4.0 I enabled an experimental feature, for automatically creating armature that can be used to animate the underlying atomic mesh, upon which MN creates the style.

I am not super familiar with armatures, so have only been looking into it a bit.

https://github.com/BradyAJohnston/MolecularNodes/assets/36021261/0c9fa2bd-a2a3-4273-ba94-a6717bde20e9

https://github.com/BradyAJohnston/MolecularNodes/assets/36021261/645b4c94-b53f-4882-ba1e-cb1327f07652

I am seeking feedback from others on what they would want out of a protein 'rig' for animating the structure. Which features would you like to see, how would you want it to work, what sort of control over if would you like?

Current potential thoughts:

eltraviso commented 6 months ago

Hey Brady, The experimental armature feature is amazingly convenient! I know from experience that attempting to manually align bones to alpha carbons is the quickest path to insanity. I think the ultimate molecular rigging tool could build on this straightforward residue-to-residue armature and allow flexibility for users to change their rig based on their projects/molecules:

  1. The simplest projects will want to add squash and stretch to the whole molecule. Programmatically this may be the easiest to implement because once you calculate the bounds of the molecule you can use the lattice modifier and control shapes. 01_DNA_Lattice

  2. Intermediate projects will want to animate different features, and perhaps be as granular as animating specific side chains. Using my point cloud method as a starting point, I used a script to assign each point to a different vertex group for each loop/helix/sheet. I then manually aligned a lattice to that given feature and applied the lattice modifier to that specific vertex group. Lastly, I rigged the lattice to deform with a bendy bone armature and linked everything together. As you might imagine, getting everything aligned and organized manually was painful. If I had more coding skill (and time) I could speed up this process by calculating bounding boxes for each feature and then aligning the lattice to that box. Similarly, for simple shapes like sheets and helices I could align one single bone to the terminal alpha carbons and use that to drive the lattice deformations. I found loops to be a bit challenging to rig in this manner because simple IK solvers struggled with the odd shapes; it was like rigging an arm with 5 elbows. I had to break loops down into multiple IK targets to allow for more granular control. Rigging individual residues was a different beast altogether. I worked out a way to create each target residue using geometry nodes (cylinders and spheres) and built each target residue from scratch, followed by manual IK rigging. Again, coding will provide a much quicker path to achieving this type of rig. 02_TM1_Lattice

  3. More advanced projects will want to layer molecular dynamics into the animation. I understand there's a way to weave molecular dynamics into Blender via Molecular Nodes, but I haven't yet attempted that. The good news is that any users wanting to import molecular dynamics into Blender will likely be interesting in preserving those positional data at all costs. No additional rigs should be required.

All of this feedback is given through the lens of the workaround rigging system that I've come up with. My system differs from Molecular Nodes in several fundamental ways (in polish and accessibility, to start). However, I think my experience has highlighted two important design principles for my ideal rigging system. First, the pipeline must be clear and editable. On a global level this means I need to be able to assign different chains to specific rigs (e.g. I want to rig a target protein and have any bound peptides be parented to that main rig). On a more granular level I need to be able to create and edit features on the fly. There are too many opportunities to get lost in residue numbering, so a rigging tool that keeps track of everything will be a lifesaver. Second, I need fast access to controls for everything. If I want my thermal motion to speed up I need that value to be accessible from Pose Mode. A visual system for labeling different features, be it control bone shape, color, or label, will also be essential during the animation process. I attempted to do as much with my GPCR rig, but I haven't given it a rigorous animation test yet.

I hope this is helpful and coherent. I would be happy to provide additional feedback or share files if you find either my DNA or GPCR rig of interest.

Best, Travis (Sneaky Genes)

BradyAJohnston commented 6 months ago

Thanks @eltraviso for all of the information! I really appreciate the feedback and for you to take the time to talk more about your process.

It seems like, for most situations, the potential to generate a skeleton that has 1 bone per secondary structure element (helix or the like) will be best for making animations. Thanks for the tips with IK, I've played around with it myself but found it to not handle molecular shapes like you described. I'll give chaining multiple IK together a go and see if it works better.

Do you use a mixture of IK / FK? How do you change between them? I have been watching lots of videos on rigging & animation just to try and grasp how the controls themselves should look and how they can practically work inside of Blender

eltraviso commented 5 months ago

@BradyAJohnston No problem! I'm excited to see what features make their way into Molecular Nodes. I think 1 bone per secondary structure is a good starting point. Loops in between elements may be tricky. For example, I found the most visually pleasing deformations if I put a short bone immediately after a helix.

I think IK will far and away be the most useful for this type of rig. The geometry is fairly packed, so there's little opportunity for an arm-like FK type of control. In addition, IK will make for more fluid animations, at least, which will help any scientists moonlighting as animators.