How to let grow PingPong balls inside an invisible box?

Inspiration / Reference

So I came by this interesting example of ping pong balls from Alvaro Navarro, where the amount of spheres are growing inside an invisible box.

So I think he is using some kind of particles to generate new PingPong balls at a point down the bottom of the invisible box, where the new generated particle balls will be pushing the already generated balls to the top using some kind of collision.

Tried

To make a simplified version for the first step, I did the following:

So I created a box. Deleted the top face and add Rigid Body Passive (so the box doesn't fall down). For simpelicity, I added one sphere with also the Rigid Body, but now type Active. Unfortunately it seems like it will set this type for all objectes with Rigid Body.

Something that is made in C4d, but don't know if this is possible in Blender, because there is no collision for each particle I've read? https://www.youtube.com/watch?v=HoxBLXKZ7gw

• dont have a whole clue, but i rekon if you had self collision, and turbulence, mixed with a camera that pedestals down (so the balls are static, but jiggly) you could approximate it or maybe have an actual piston pushing up through the balls (again with teh physicss and turbulence) – Robert Oct 11 '20 at 14:17
• What have you tried? What has failed? What is your level of expertise? – Leander Oct 11 '20 at 14:36
• At the moment, at least, this looks like a typical application for the Molecular add-on – Robin Betts Oct 11 '20 at 16:32

2 Answers

You can achieve a similar effect with builtin physics engine.

Just add a bunch of spheres to your scene, set physics type to Rigid Body, Active and collision shape to Sphere. Set it up in advance before duplicating, or copy it afterwards.

Place them inside an invisible container with a simple box-like shape, like the default cube.

Now you need to push them against a wall. Do so by either animating the container shape, or optionally using a second animated object to push them around.

The illustrated example uses an animated squashing box. In retrospective you could probably animate its scale instead, avoiding changing shapes and expensive mesh morphing physics, but this example uses shape keys.

Set the cube mesh up with Rigid Body type physics, with both Dynamic and Animated active, and collisions set to Mesh type, Source as Deform and Deforming option active.

Add one additional shape key besides Base, for that shape key move the back face forward enough distance to squash the desired amount of spheres against the front face. Keyframe the factor for that shapekey from $$0$$ to $$1$$ for the desired duration of the animation.

• This simulates the ref. better than Molecular, and is a lot less hassle to set up. – Robin Betts Oct 11 '20 at 20:35
• It is also surprisingly fast and responsive. I was already prepared for a slow mess that required a pre-calculation pass for smooth playback but it actually allowed real time tweaking – Duarte Farrajota Ramos Oct 11 '20 at 22:05
• And a little mathematics: the height of the pile of balls times the depth of the shrinking box will stay roughly constant. So if you want the height to grow linearly, as it would for a constant-size box with a constant-rate supply of new balls, then you should have the depth of the shrinking box be proportional to the reciprocal of the time, d = c/t (d is depth, t is time, c is a constant that you can choose freely). (Never having used Blender I don't know how easy/hard that is to set up.) – Daniel Wagner Oct 11 '20 at 23:29
• @DanielWagner interesting observation. I didn't really give it much though, so as it currently stands shrinkage progression uses default non-linear keyframe easing progression, but you can easily tweak the curve to anything you like. You can also use an F-Curve modifier to input some custom math function and obtain a constant rising speed. – Duarte Farrajota Ramos Oct 11 '20 at 23:38

There is an amazing add-on for blender called the Molecular Addon. It allows collisions between particles and has worked perfectly in my experience, handling things from ball pits to sand extremely well. It is also easy to use and I quickly picked it up.

Download it here (choose the version labeled for your OS): https://github.com/scorpion81/Blender-Molecular-Script/releases

A tutorial I followed: https://www.youtube.com/watch?v=uUFjolR3Fr0&t=424s. Note that he explains almost all of the settings in the addon (there aren't a lot), for your situation you will only need to make use of a few of them. Settings like particle adhesion, etc. are available but aren't needed for your case.

Another things: You can't just press the play button to have the addon take effect, you have to scroll to the "bake" option inside the addon. When baking, I usually use around 10-20 substeps.

• Thank you for your time and information. I watched tutorial and came pretty close. The only thing is that the generated particles fly all over when generated. I really want that soft look of that reference animation above. Don't have use velocity. Can you help me with that? prnt.sc/uxa7e7 - And if I understand it correctly, it is true that it is not possible with the build in particle emitter? – Caspert Oct 11 '20 at 18:46