Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

How to create collisions in a MASH network with nCloth instances?

How to create collisions in a MASH network with nCloth instances?

maja.divjakW2VMQ
Advocate Advocate
8,795 Views
37 Replies
Message 1 of 38

How to create collisions in a MASH network with nCloth instances?

maja.divjakW2VMQ
Advocate
Advocate

I’ve been trying to learn MASH and use it to create a lipid bilayer, which is the fatty layer surrounding all animal cells, to keep the cell contents in and all foreign bodies out. I’ve created three nCloth animated lipids, created a MASH network and then assigned them using the ID node. I then used replicator nodes to repeat the lipids numerous times and then another to create the inside layer, by rotating in Z 180 and offsetting the position in X and Y. This works really well and plays back really quickly, compared with my previous approaches. The problem I’m having is with collisions. I will need to be able to collide molecules with the inner layer of lipids and also have the lipids collide with molecules that actually reside within the membranes. I've attached a couple of images of the lipid bilayer, with animated nCloth lipid instances. You can see a lot of repetition and intersection because I only used three instances in this rough test.

 

What I’d like to do is have the lipids close to the grey cylinder (a receptor standin) collide with it and I’ve been tearing my hair out as to how to do this. I’ve tried adding a MASH dynamics node and then a spring constraint within that, but the dynamics node slows the system to virtually zero. I’ve tried to find a way of limiting the dynamics effect to a small area around the cylinder, but couldn’t work this out. I’m sure there is a really simple way to achieve this, but my inexperience is hindering me. If you could please advise how to limit where the dynamics node is felt or a way of achieving collisions without the dynamics node, that would be absolutely fantastic.

0 Likes
8,796 Views
37 Replies
Replies (37)
Message 21 of 38

maja.divjakW2VMQ
Advocate
Advocate

Thanks Matt,

Of course!

I tried this and created a bilayer of 1800 lipids, which as expected, animated really slowly at 0.4fps. But, you could alembic cache again to speed this up.

Results are attached. In retrospect, I would up the signal node to give much more jittery animation in the creation of  the initial models, but as proof of concept, it works! The lipids collide and the nCloth quality is lovely.

One thing I didn't include was collision objects, which I assume you'd add when you import the three alembic caches and make your first dynamic MASH network?

Thanks so much for going above and beyond, I really appreciate your wonderful support, as always.

Best wishes,

Maja

0 Likes
Message 22 of 38

maja.divjakW2VMQ
Advocate
Advocate
Accepted solution

Thanks Matt,

Of course!

I tried this and created a bilayer of 1800 lipids, which as expected, animated really slowly at 0.4fps. But, you could alembic cache again to speed this up.

Results are attached. In retrospect, I would up the signal node to give much more jittery animation in the creation of  the initial models, but as proof of concept, it works! The lipids collide and the nCloth quality is lovely.

One thing I didn't include was collision objects, which I assume you'd add when you import the three alembic caches and make your first dynamic MASH network?

Thanks so much for going above and beyond, I really appreciate your wonderful support, as always.

Best wishes,

Maja

0 Likes
Message 23 of 38

t_chanma
Autodesk
Autodesk
Accepted solution

The easiest way would be to just create another MASH network of external collider(s) (yes, even a distribution of just 1 object is okay), and apply a Dynamics node to that.  By default, all the MASH networks use the same solver.

 

Alternatively, you can also select an object to become a collider and go to MASH > Add Shell Dynamics.  This is simpler, but I've had instances where the results aren't as good.

 

And you're very welcome!  Also, if you consider the issue solved, please don't forget to mark the solutions using the green buttons on the posts.  It just helps us with forum post tracking.  = )



Matt C

Senior Content Experience Designer

Maya Documentation | Maya Learning Channel |
0 Likes
Message 24 of 38

maja.divjakW2VMQ
Advocate
Advocate

Thank you again, works beautifully.

Which post would you like me to accept as solution please? The one with your outline or the one where I went step by step through what I did?

 

Thanks so much!

 

Maja

0 Likes
Message 25 of 38

t_chanma
Autodesk
Autodesk

I believe you can actually do both!



Matt C

Senior Content Experience Designer

Maya Documentation | Maya Learning Channel |
0 Likes
Message 26 of 38

maja.divjakW2VMQ
Advocate
Advocate

Done!

Thanks so much once again, this has helped me learn so much more about MASH and it's possibilities. Excellent support!

 

Best wishes,

 

Maja

0 Likes
Message 27 of 38

maja.divjakW2VMQ
Advocate
Advocate

Hi Matt,

Sorry to reopen this post!

I've noted that when I create the initial movement on the lipids using a MASH network and a signal node that creating nCloth out of the repromesh completely removes the effect of the signal node and everything becomes totally static ie the the nCloth completely overrides the MASH and you need to add movement using a turbulence field. Is there any way of overcoming this please, so that each lipid has some overall movement as well as internal movement provided by the nCloth?

 

Thanks so much and best wishes,

 

Maja

0 Likes
Message 28 of 38

t_chanma
Autodesk
Autodesk

Actually, the way I created movement was to create a MASH network out of a sphere, then apply signal noise to that network so that the spheres sort of bounce around.  Then I "wrap" that network with an nCloth ellipse to act as the membrane (i.e. the membrane itself is not a MASH network).  Once I alembic cache a few of those, then I turn them into a MASH network (the cloth animation will be maintained because at that point it's just animation on the mesh itself - sort of like a pre-recording).



Matt C

Senior Content Experience Designer

Maya Documentation | Maya Learning Channel |
0 Likes
Message 29 of 38

maja.divjakW2VMQ
Advocate
Advocate

Hmmm, I get what you did in theory, but not in practice. so, I had a crack at this and it's almost there, but not quite. This is what I did:

1. created a MASH network from 10 lipids, 5 upper and 5 lower (to create a small bilayer), added a signal node to give nice jittery animation to individual lipids. All good.

2. I then used the same lipids, combined them to make a single mesh and then created nCloth from them. Turned off wind and gravity

3. I then selected the combined mesh and then the MASH repromesh > deform > wrap ie I tried to create the  'wrapping' of the nCloth to the MASH network you described. This did not yield a nRigid node as appears in your scene file and also completely killed the nCloth movement, although the MASH movement was now there

4. I had to add a turbulence field to give back some movement to the nCloth

So the result is correct MASH movement, but with somewhat damped nCloth and some unattractive nCloth deformations. The result is the same whether I create the nCloth from a combined mesh or from individual lipids. However, as I mentioned, it's almost there. If you could please explain in detail how you performed the 'wrap', that would be great. I've attached a file showing the result.

If I export to alembic and reimport to a new file, this plays at full speed, so if I can get the nCloth and MASH to play nicely, this will be great

 

Thanks so much,

 

Maja

0 Likes
Message 30 of 38

t_chanma
Autodesk
Autodesk

Would it be possible to attach a scene file here?  I'm having trouble figuring out what you're trying to do in steps 2 and 3.



Matt C

Senior Content Experience Designer

Maya Documentation | Maya Learning Channel |
0 Likes
Message 31 of 38

maja.divjakW2VMQ
Advocate
Advocate

Sure, here you go!

Could you please explain what you mean by 'wrap'? When you say you 'wrap' the MASH network (that has the signal node on it) with a nCloth ellipse to act as the membrane, what do you mean by this? Which commands do you perform here? I thought you literally meant use the 'wrap' command ie select the MASH repromesh and then the nCloth mesh > deform > wrap. I don't understand how you're getting the MASH network and the nCloth to interact - mine seem to negate each other.

 

Thanks so much,

 

Maja

0 Likes
Message 32 of 38

maja.divjakW2VMQ
Advocate
Advocate

Sure, here you go!

Could you please explain what you mean by 'wrap'? When you say you 'wrap' the MASH network (that has the signal node on it) with a nCloth ellipse to act as the membrane, what do you mean by this? Which commands do you perform here? I thought you literally meant use the 'wrap' command ie select the MASH repromesh and then the nCloth mesh > deform > wrap. I don't understand how you're getting the MASH network and the nCloth to interact - mine seem to negate each other.

Thanks so much,

Maja

0 Likes
Message 33 of 38

maja.divjakW2VMQ
Advocate
Advocate

Sorry, I can't get the file to attach for some reason

0 Likes
Message 34 of 38

maja.divjakW2VMQ
Advocate
Advocate

Just discovered the file I attached will no longer open. Here is another that actually works.

Apologies for the kerfuffle.

 

Thanks so much,

 

Maja

0 Likes
Message 35 of 38

maja.divjakW2VMQ
Advocate
Advocate

Oh right, I get why you're confused now:

1. created a MASH network from 10 lipids, 5 upper and 5 lower (to create a small bilayer), added a signal node to give nice jittery animation to individual lipids. All good.

2. I then used DUPLICATES of the same lipids, combined them to make a single mesh and then created nCloth from that. Turned off wind and gravity

3. I then selected the combined mesh (that I made nCloth out of) and then the MASH repromesh > deform > wrap ie I tried to create the  'wrapping' of the nCloth to the MASH network you described. This did not yield a nRigid node as appears in your scene file and also completely killed the nCloth movement, although the MASH movement was now there

4. I had to add a turbulence field to give back some movement to the nCloth. As described previously, you will see the nCloth is somewhat overridden by the MASH and there are incorrect nCloth deformations.

 

I hope this makes more sense- hopefully the scene file attached above will help.

 

Have a great weekend,

 

M.

0 Likes
Message 36 of 38

t_chanma
Autodesk
Autodesk

Ah okay, I see where our miscommunication came up.  Basically, I thought that each of these shapes was itself a bilayer, and that each of these meshes was a membrane.  I was suggesting to animate their "insides" (as in, a few small spheres or other primitives bouncing around inside each one) and then make the shell ncloth, then cache that out to place in a larger MASH network.  

 

However, what you're doing here is fine too, and actually you're super close to a solution.  First, know that you CANNOT have both vertex animation + ncloth simulation (or any simulation) on the same mesh - there's just no way for Maya to know how to resolve that (as you've discovered).  However, what you can do is select the nCloth mesh (get rid of the turbulence or maybe just recreate the cloth on this one to be sure it's clean) + the original animated mesh and go to nConstraint > Attract to a matching mesh.  This will constrain the nCloth points to their counterparts on the animated mesh, while still keeping their ncloth properties.  That should get you exactly what you want.

 

A few notes on this: First, you'll probably want to space out the initial MASH network even more - ideally so that none of these meshes are touching on frame 1 in order to ensure the nCloth solves nicely.  Second, you'll probably need to adjust the nCloth properties after you do this, because it's difficult to notice the nCloth working since the meshes just jitter and don't really fully collide.  I'd recommend dropping the collision friction and maybe increasing bounce.  You'll might also need to change the Self Collision Flag and Self Collide Width Scale.  You can play around with these to get it looking the way you want.  In order to see the results at full speed, you'll need to cache out the result or playblast (Windows > Playblast) it.  See attached for the modified version of your scene.



Matt C

Senior Content Experience Designer

Maya Documentation | Maya Learning Channel |
0 Likes
Message 37 of 38

maja.divjakW2VMQ
Advocate
Advocate

Thanks so much Matt,

Have got this working beautifully. Will post results tomorrow and what I actually did.

Have a great day,

Maja

0 Likes
Message 38 of 38

maja.divjakW2VMQ
Advocate
Advocate

Ok, so here is the final summary of what I did and attached is a sample animation. I'm very happy with this result and simply could not have done it without your stellar suggestions!

 

  1. Using a set of 5 upper lipids and 5 lower lipids to make a bilayer, use these 10 to make a linear MASH network, add an ID node and then a signal node to create movement on each lipid as a whole unit (used 4D noise). The signal node was also animated in X, Y and Z
  2. Duplicate these 10 lipids, combine them to make a single mesh and then create nCloth from this
  3. Turn off wind and gravity on nCloth, set friction to 0 and set manual pressure up high eg > 5 to maintain nCloth shape
  4. Now nConstrain the nCloth mesh to the MASH repromesh using ‘attract to matching mesh’ so that the nCloth includes animation provided by the MASH signal node. Set the connection method to ‘nearest pairs’, set strength really low (< 0.1) and glue strength < 1 so that lipids jiggle around nicely
  5. Play with your solver substeps and collision iteration settings so the nCloth solves nicely
  6. Save your file then export the nCloth mesh as an alembic cache
  7. Repeat this process twice more, so you have three alembic caches to work with 
  8. Import the three caches to a new scene, select them and make a linear MASH network and add an ID node
  9. Add a dynamics node, turn off gravity on the bullet solver and adjust positional and rotational strength so that lipids don't float away. This allows the separate lipid models to collide with each other. These are hard body MASH collisions, not soft body
  10. Now alembic cache this 30 lipid simulation, reimport and build another linear MASH network, add a replicate node and random node to create a massive lipid bilayer and then apply a dynamics node yet again
  11. If you want to have objects collide with the lipids eg other molecules or membrane-embedded receptors, create another MASH network out of those and apply a dynamics node. By default all MASH networks use the same solver, so will interact with one another