Thinking Particles bullet physics tutorial and scene.

Hi! Today in Montreal we have a snow storm, so I pass the day in my house looking some vimeo videos. I found this popcorn effect from Toufik Mekbel  done it with pflow toolbox2. So I decided to do the same effect with TP and share with you.

Its really easy to do in fact with TP, so here I will post some screenshots and a little description of what every rule did. You can download the complete scene and study more how it works everything.

The concept is: The corn is generated from a surface and it falls down. When corn pass certain height (near frypan), they pass from “falling”  (white wire color in video) to “in frypan”(red wire color). In frypan the corn is heated and in a random value of time they pass to next rule “popcorn” (yellow wire color). When enters to popcorn group the particle change his shape, has some initial velocity and also scale is animated (since the shape increase a lot if we do the change in just one frame we will have some problems of interpenetration, making a gradual scale bullet can calculate better collisions).

So here we go:

Here you can see how groups are organized. In this first dynamic system we create corns from a surface, adding some spin, random alignment and instance the corn shape. At the same time we have an objTo particle to instance our frypan, we sended to “deflectors” group. Rate value is animated to have first less corns and after more.

 Gravity is affecting all particles except frypan.

.

The core of all dynamic system. We create it with BulletPhysics, The most fast dynamics system inside TP (1000frames calculated in less than 2 minutes in an I5 laptop). Everything is by default here, only in general Master system, samples per second is set to 250 samples per second. (You have to increase it if you see some interpenetrations). Corn and popcorn groups are set as active “convex”, and frypan (“deflectors”) are set as “mesh” and kinematic.

.

.

.

Our corns are falling, When they arrive near the frypan  change to group “in frypan”. This is simply done  reading z value and with a threshold sent to desired group.

In frypan we reset the particle age. This rule is like “reset particle age” in pflow. We have a particle age set to “enter group” so when particles enters in group we put his age to zero. This is done with a ParticleData op, and a float with “zero” value.

Right now we have our particles age set to zero, I defined a Random value per particle and animation and send this to the group “popcorn”. With this some particles will go to popcorn group faster and others will take a little more.

.

When our popcorn is born we change his geometry with a “GeomInstance op”. We add some vertical velocity with random values only when particles enters in the group, and some rotation friction.

.

If we don’t add this last rule our system will work but will be a little unestable since it change from a little geometry (corn) to a bigger geometry (popcorn) inmediatly and system can’t interpolate values. So we do a soft change with “scale over time” rule.  Is a very basic setup for animate parameters inside TP, we have our Timer and this float helper animated from 20 (popcorn has near the same size as corn) to 100 in 3 frames, so TP can interpolate between 3 frames and calculate better collisions with a much better result.

You have the popcorn scene here if you are lost in some step (3dsmax 2010 and TP5), and you can add any comment or question below!

Popcorn scene

Leave a Comment

Your email address will not be published. Required fields are marked *