• 1/3

Dynamic Jello Simulation

Posted by Duncan Brinsmead, 31 October 2012 10:21 pm

One can use nParticles to create a jiggling Jello substance that can be sliced using an nConstraint with breakable bonds. The workflow is relatively quick and easy.

Download Scenefile: jelloSlicer.ma

Step 1: Model a "mold" in the shape you want the Jello to be in and select it.

Step 2: Fill the mold. Use the create nParticle fill method with close packing OFF and resolution high enough to be able to represent your shape well... somewhere around 60. Use the balls preset option on the create nParticle menu. Hide the mold when done.

Step 3: Select the particle system and create a Component to Component nConstraint.

Step 4: Edit the constraint. Set the connectionMethod to "Within Max Distance" and make the max distance as low as possible while still producing connections. Be carefull because if it is high you will get an enormous number of connections and it will be slow. If it is set right you should see a cube lattice with no diagonal connections. Set the constraint strength to around 2.0 (lower if you want it to be more floppy). Note that this simulation relies in part on self collisions between particles. The links by themselves can make the jello pretty stiff without self collisions if the strength is high, however the collisions allow the jello to be incompressible(as fluids are). In the example file the self collisions are turned off and instead liquid simulation(enableLiquidSimulation) is used for this incompressibility. This can be faster than self collisions and also can behave more naturally. One needs to carefully set the liquidRadiusScale when doing this.

Step 5: Enable "Use Plane" on the nucleus node and adjust the attribute "Space Scale" to match the proportions of your object.  If you modelled in meters then leave it at 1.0 but if you modelled in cm. then the space scale needs to be set to 0.01 to match real world gravity. Note that for real world gravity at the scale of small objects the motion is very fast and thus one needs a high setting for substeps. The constraint strength may also need to be higher than 2 for a real world gravity setting. In the example scene file and video the space scale was left at 1.0 and the resulting gravity was weaker than in real life (for the scale of my mold) resulting in a slow motion simulation that only require substeps around 10. You can now play the simulation and see how it behaves. Note that rewind will be slow as the simulation recreates the constraint connections at the start frame, and this can be slow for max distance constraints when the number of particles is high.

Step 6: Set Glue Strength on the nConstraint to allow the constraint bonds to break under stress. The exact setting is a bit finicky and depends on things like constraint strength, gravity and substeps. At any rate you want the glue strength to be just barely high enough that the jello does not fall apart under gravity.

Step 7: Create a knife and cut the jello. The knife object could be a simple wedge shape. Select it and do nMesh: Create Passive Collide so that it will collide with the particles. You can then keyframe its position so it cuts the "jello". If the bonds don't break when cut then lower the glueStrength to the point that they do.

Step 8: Cache the simulation. Once you have a simulation you like then select the particle system and do nCache:create new cache.

Step 9: Create the jello mesh. Select the particle system and do "Modify: Convert: nParticle to Polygons". (note this enables intermediateObject on the particle shape, which hides the particles) A crude mesh will initially appear. This is because the triangle size default may be too large. Adjust the triangle size to get a good but not too detailed mesh. The quad mesh method with the meshSmoothing set to 3 can create nice clean meshes. Then adjust the blobby radius scale and the threshold to get a smooth mesh.  It is easier to get a smooth mesh if the triangle size is as large as possible. For smaller triangle sizes one can still get a smooth mesh but the blobby radius scale and threshold values both need to be larger: one might need a threshold significantly greater than 1.0.

Step 10: Assign your favorite jello shader and render. In this example scene I used caustics,  final gather and full deformation motion blur. The raytrace refraction limits need to be fairly high. I used a red blinn shader with red transparency, raytrace refractions and a refractive index of 1.3. An miRefractionBlur setting of 0.8 helps make the internal refractions slighly blurry.



Posted 1 November 2012 9:53 am

Awesome, love seeing how stuff like this is done


Posted 1 November 2012 11:18 am

Hello Mr duncan,
i think we are all waiting for a massive and complete tutorial in maya vfx , dynamic and particle system with scripting.maybe for 150 or 200 hrs.
You have to do it !!! give your exceptional skills and knowledge,
you're one of the maya father , and it will be a Honor to learn with the master !! So i think all the autodesk maya community is waiting for you


Posted 1 November 2012 12:03 pm

wow!cool!I hope I go far,so I like learn to masters who as you.I don't want to wait a minute and do it,until I do well.But I afraid render bad for weak rendering skills.


Posted 5 November 2012 2:26 pm

I am always impressed with what duncan can pull off using particles. I agree with manel about you doing a massive tutorial either for free or for sale.


Posted 6 November 2012 12:02 pm

Hi and fisrt of all thank you for this tutorial.

Can you help me with a problem?

In my simulation I cut the jello and one half fall on top of the other, the problem is that when I create the output mesh it appears as a single object and not as two object one on top of the other: how can I solve this?

Duncan Brinsmead

Posted 6 November 2012 2:41 pm

This is a problem because the isosurface creation is based on the overlap of particles, and this code is unaware of the broken constraint connections. If you added an invisible cloth mesh between the two split parts (after cutting) it might keep them separated enough for a surface to form. On the particle shape you could perhaps lower the blobby threshold and the blobby radius scale, but this will make the surface more bumpy. Also the more dense the particle(the higher resolution of the particle fill) the closer the chunks can be before they merge. However they will always merge when in collision unless you stick something in-between. If the split chunk was moved into a separate particle system it would not merge, but I don't know an easy way to do this automatically based on the constraint breaking.


Posted 12 November 2012 6:56 pm

you're Fantastic!!!


Posted 8 December 2012 10:50 am

at rvb3n.
Cheat. When cutting with knife animate ncloth plane to follow it (take of rendering from it) which will then separate jello top and bottom.


Posted 30 January 2013 5:51 pm



Posted 10 October 2013 1:48 am

Hi Duncan,

Can you give me some guidance on how to create a jello shader like the one you used above? I created a blinn and changed the settings based on your post, but the proper look and feel still eludes me. Is there a particular light setup I should be using? How high did you use for the refraction limits?


Duncan Brinsmead

Posted 10 October 2013 4:58 pm

The scene file can be downloaded at the top. You can see the various light and render settings in the scene. The refraction limits don't need to be too high... but make sure they are set both on the global raytrace settings as well as on the shader. On the blinn shader making the specular rolloff low makes the shader only reflective for glancing angles( raytrace reflections, not just the specular )... that is important for a "wet" look. The various settings for mental ray caustics needed a bit of tuning to get the right look as well.


Posted 10 October 2013 6:48 pm

Thank you so much Duncan, sorry I missed the scene download link above.


Posted 13 December 2013 12:18 am

A great technique, but the main limitation is that you need to get your final particle sim done before converting the nParticles to polys, as you cant seem to afterwards (?). You are then left with shape-baking the 'jello'.

Duncan Brinsmead

Posted 13 December 2013 12:31 am

The particles have intermediateObject enabled when converted to poly. This hides them, while still allowing them to compute(unlike visibility, which keeps them from computing). However I think this may affect caching. A workaround is to temporarily turn off intermediateObject on the particle shape, cache then re-enable.

Add Your Comment

You must be logged in to post a comment.

Please only report comments that are spam or abusive.