PDA

View Full Version : Dynamic question!



jaxtone
09-15-2015, 04:52 PM
Hi!

I just tested a few scenes with Bullet, dynamics and Gumballs!

However, I just don't get how to make the gumballs to react as wanted!

What in Gods name have I done to deserve a bunch of undisciplined gumballs that doesn't do what I want them to?

If anyone could take a look at the attached zip file I would appreciate it.

Guess it would be a good idea before I add particles and instances to the scene!

Regards, Jack

prometheus
09-16-2015, 12:56 PM
Hi!

I just tested a few scenes with Bullet, dynamics and Gumballs!

However, I just don't get how to make the gumballs to react as wanted!

What in Gods name have I done to deserve a bunch of undisciplined gumballs that doesn't do what I want them to?

If anyone could take a look at the attached zip file I would appreciate it.

Guess it would be a good idea before I add particles and instances to the scene!

Regards, Jack

There is one big issue with all this...You tell us that it doesnīt react as wanted, But...how do you want them to react? the scene setup doesnīt say much unfortunatly.

Edited...uhmm..maybe the yellow ball going through the ground?

prometheus
09-16-2015, 12:59 PM
and why on earth are the balls in mid air...:)

prometheus
09-16-2015, 01:08 PM
I would clear the keyframes you have on the cueball.

maybe add a master null and parent all balls to it, then make sure the master null is in zero location, select all balls and move them up 5 mm or so they rest on the ground in location so to speak.
Turn of dynamics when parenting and position it all on the first keyfram, I think that might be the trouble otherwise..even if you lock the y and z axis..with dynamics active when setting the keyframe..it will not lock it properly.

prometheus
09-16-2015, 01:19 PM
hereīs a quick fix, though it isnītīperfect..the balls donīt spin accuratly, so there are things to improve on.
I renamed the table as pooltable and changed color, also extruded the ground, removed all ball keyframed and repositioned them, and some other stuff..the scene is gumballtest:02

Edit...some stuff was wrong with my scene too..you can delete the master null, you really donīt need it.

and I got some error keyframes to, which moved the cue ball(effector) up too much.

prometheus
09-16-2015, 01:52 PM
And...I did some rescaling, billiard balls are not that small so I rescaled to real dimensions, and also set a much much lower weight than 1000, more exactly 0,165, and it seem to behave more properly, I rescaled the pooltable to more real size.
all that isnīt in the above scenes though...might post later.

prometheus
09-16-2015, 02:01 PM
And for the funny part:)

I failed to recognize it as candygums :) thought you were making pool balls..haha, the numbers fooled me.

MonroePoteet
09-16-2015, 03:03 PM
I made some adjustments to the original scene: increase the collision margin to 1mm to avoid falling through the floor, set the mass of each pool (gum?) ball to a more meaningful number (0.2kg) for better bounces, and increased the Linear Damping to 50% and the Angular Damping to 20% on each ball.

To avoid the "jitter" inherent in Bullet simulations (where objects / pieces NEVER come to rest), I've tended to use an additive Gradient with a Distance to Object to ramp the damping way up when I want the objects to stop. In the attached scene, I just used the distance to the existing null, but it would take some fine-tuning to get them to actually stop and stay stopped.

FYI, months ago I spent a LONG time trying to simulate a billiard / pool table with Bullet, and was never successful. I could never even get ONE ball to act "normally", bouncing off the bumpers correctly and rolling to a stop after being struck with a cue stick. To get separate balls to roll to a stop separately, I ended up adding a "damper null" as a child to each ball, setting up the gradient so distance to the object at (0,0,0) maximized the damping (both linear and angular), offsetting the child by 1m from each ball, running the simulation and determine the frame where each individual ball should stop, and run the damper null in to (0,0,0) at that frame. A real pain.

Best of luck!

mTp

Greenlaw
09-16-2015, 03:35 PM
I haven't looked at the scene but can I assume you're using a single parts object? That almost always jitters because, being a single object, it's very difficult for it to ever truly come to rest with itself--maybe some parts are infinitely falling or the object has a couple of parts perpetually colliding with itself somewhere.

If you really need the sim to come to a complete rest, break the elements into separate layers. This makes it much easier for each piece to 'go to sleep' since each piece can independently reach its own rest state.

G.

MonroePoteet
09-16-2015, 04:08 PM
I haven't looked at the scene but can I assume you're using a single parts object? That almost always jitters because, being a single object, it's very difficult for it to ever truly come to rest with itself--maybe some parts are infinitely falling or the object has a couple of parts perpetually colliding with itself somewhere.

The three pool balls are separate objects, set to "Rigid" in Bullet. They never come to rest without either severly limiting the natural roll (by bumping the Linear damping up to 80-90%) or ramping up the damping coefficients as described. To get a desirable amount of roll, I set the Linear damping to 50-60%, but without the Gradient damping scheme I described, the ball sits and jitters up and down for the remainder of the scene (bump the frame count to 300). Maybe I'm doing something wrong. Also, I'm still on V11.6.3, so maybe LW2015 does a better job of naturally damping the Bullet-calculated motion.

mTp

Greenlaw
09-16-2015, 04:35 PM
Okay. I'll take a look tonight. I don't think it will be any different for 2015 but will let you know if it makes any difference.

prometheus
09-16-2015, 05:37 PM
MonroePoteet...thanks for the tip on damping gradient etc..will have to take a look at that, but first I will try painstakingly like you to set it up without that, and see if I can get any close to real physics behavior in terms of spin etc and getting it all to rest.

hereīs another scene, made a fast pooltable with what I believe to be proper dimensions, and also the balls(only 3 balls for testing yet), the table lacks pocket holes too, so I would have to remodel when I get the time.

129777

Oh...and the pooltable should be set to convex not box.

jaxtone
09-17-2015, 01:47 AM
Hi, Promotheus and the rest of my waving friends!

Sorry, I admit it was a really wage description of what I wanted out from this scene. I will try to explain as good as I can but first will explain that this was just a test to see if the "gumballs" were affected by dynamics correctly as I used Lino Grandi's tutorial where he had one of the objects to affect the others as a reference: https://www.youtube.com/watch?v=HLSXZ9EIXzU

Since you asked for a better explanation, here's the idea! I want to merge a small girl, a rat, a minimal pool table and a handful of physical gumballs. I've actually bought a bunch of real miniature gumballs designed as pool table balls in a candy store into a scene with both film and CGI in a museum where it is supposed to be quiet. (I now understand that the size matter could be misunderstood.)

The CGI gumballs are supposed to be integrate in a high number into this scene to interact with the real miniature gumballs with a short story included. (Strange that I actually doing this when my pockets are empty. But since I am more interested in story telling than technical does and don'ts I just have to suck the pain and go on. I must add that it might be an excellent moment to get back on the track though it is a real pain to see your heart mate slowly disappear in a total disaster caused by the medical science.)

1. A little girl in a skirt enters the museum nice and quietly.
2. She watches the stuffed animals in the glass stands when she hears a strange sound from behind the walls in the museum.
3. A rough rat in a leather jacket stores an awful lot of gumballs in his cave behind the walls of the museum.
4. By accident these gumballs are falling down and starts rolling out from the hole in the museum wall.
5. They end up in front of the girl in the skirt.
6. She picks up a handful of gumballs in her hand.
7. The mouse in the leather jacket desperately notice that sheīs about to taste his property.
8. The girl puts one of the gumballs in her mouth and starts to chew.
9. Our fellow mouse becomes furious and in a rage he starts run till he's upfront to the girl and takes a jump.
10. She blows a bubble that captures the mouse before it explodes.

By the way I really appreciate that you tried to help transforming the gumballs into pool table balls... its not totally wrong but a matter of size since I guess the girl never could manage to chew the pool balls! This is actually the real size but thanks anyway!

MonroePoteet
09-17-2015, 04:40 PM
OK, thanks for the explanation of the scenario.

I've attached a sample scene. It uses an "array" (i.e. a bunch of) your gumballs as a "Parts" object (make sure it's set to Convex Pieces), a non-rendering funnel to direct them horizontally, and your beige floor object. The funnel is not rendered by clearing the Seen by Camera and Shadow options on the Properties=>Render panel. I messed with the linear and angular damping to get it to act fairly well, and then ramped it up using an Envelope to get them to stop at around frame 100.

The "array" was created by using the Array tool (Y) on a point to create 200 points in the Y axis, with jittered offsets in X and Z. Then, using the Random Select (points) available here:

http://www.mikegreen.name/Lscripts.html#Random_Select

to select 33% of the points, cut-n-paste them to a separate layer, and then Point Clone Plus to place the Yellow gumball onto those points. Repeat with 50% of the remaining points for the Blue gumball, and then the remaining points for the Green gumball.

Hope it helps!
mTp

m.d.
09-17-2015, 05:46 PM
Just FYI....scene scale and FPS are totally interdependent

According to the bullet manual (the actual bullet physics manual, not the lightwave help files)

The minimum size for moving objects in earth gravity is 20 centimeters @standard bullet default of 60fps....(lightwave defaults it to 180 fps) and a 1 centimeter object at earth gravity requires at least 300FPS to sim correctly. The smaller the size, the faster the FPS needs to be set....it is in reality the simulation step.

Being that 60Hz can only sim 20 centimeters and it takes 300Hz to sim 1cm you should also raise the FPS to near 300Hz for your 2cm balls....Not really the issue here, but just to keep in mind for very small object scenes

jaxtone
09-18-2015, 10:35 AM
Hereīs an updated scene m.d. I couldn't manage to send the whole project file since it seems to be a limit of size function on this forum. I tried to upload a zipped file on 11 mb a couple of times without success, but I try this instead and guess that works better.

1. I actually couldn't stop the gumballs from and endless trembling with the "convex pieces" setting so I changed to "sphere" setting instead. Then they at least stopped from trembling between frame 77-86 even if the end seems to be very static and sudden. Do not know how to make the gumballs slow down before they stops moving smoothly to find their inner peace. But besides this they start to tremble again at frame 87 and I actually don't understand why.

2. About the fact that the gumballs bounce on the floor is totally gone I guess its some setting I don't are aware of that makes them end up very static on the ground.

3. I am no expert here but for sure downloaded and installed the "http://www.mikegreen.name/Lscripts.html#Random_Select" after you advice. But to be honest I don't have a clue of when or how I open it. I do not know where it is supposed to be included. but would really appreciate some help and explanation here if you have a spare minute.

Regards, Jack

jaxtone
09-18-2015, 10:42 AM
MonroePoteet!

About the fact that balls never come to rest I think I managed to fix that. I changed the settings in linear and angular damping to the values included in the attached scene file and even made them stop from moving by give the TCB spline value 1.0 on the "tension".

But I would really like to know how to fix the bounce and keep balls from falling through the ground plane!

Regards, Jack





I made some adjustments to the original scene: increase the collision margin to 1mm to avoid falling through the floor, set the mass of each pool (gum?) ball to a more meaningful number (0.2kg) for better bounces, and increased the Linear Damping to 50% and the Angular Damping to 20% on each ball.

To avoid the "jitter" inherent in Bullet simulations (where objects / pieces NEVER come to rest), I've tended to use an additive Gradient with a Distance to Object to ramp the damping way up when I want the objects to stop. In the attached scene, I just used the distance to the existing null, but it would take some fine-tuning to get them to actually stop and stay stopped.

FYI, months ago I spent a LONG time trying to simulate a billiard / pool table with Bullet, and was never successful. I could never even get ONE ball to act "normally", bouncing off the bumpers correctly and rolling to a stop after being struck with a cue stick. To get separate balls to roll to a stop separately, I ended up adding a "damper null" as a child to each ball, setting up the gradient so distance to the object at (0,0,0) maximized the damping (both linear and angular), offsetting the child by 1m from each ball, running the simulation and determine the frame where each individual ball should stop, and run the damper null in to (0,0,0) at that frame. A real pain.

Best of luck!

mTp

MonroePoteet
09-18-2015, 02:50 PM
The bounciness is controlled with the Bounce parameter, which you only have set to 10%. Try 100%, and if you get too much bounce back it off to a lower value.

To keep the balls from falling through the floor, increase the Collision Margin. Set it to 5mm, for example. The issue with increasing this parameter is then the balls "hover" above the actual floor. What I've done with some success is make a non-rendered collision object beneath the floor at the Collision Margin value. The collisions are accurately calculated, but the balls rest on the floor. You could also try increasing the subdivisions on the floor object, but even then, with a Collision Margin that's too large, some balls will fall through.

mTp

m.d.
09-18-2015, 05:49 PM
Sphere collision shape and box for the ground is the way to go...resolution isn't a problem then and the shape is mathematically perfect, I would only use convex pieces if your model has convex shapes

I didn't play with it much, but I got them to stop and behave ok by simply raising the linear and angular dampening and bumping the FPS to like 800

One thing I found is the deactivation parameters have never really worked for me....I'll have to test in houdinis bullet solver to see if it is a lightwave bug.....but in reality the deactivation controls would be your first line of defense....should cut off all motion under a certain threshold....
I know I tested it extensively with a parts body.....and it definitely doesn't work there

Greenlaw
09-18-2015, 06:32 PM
Yes, that's what I meant earlier: You need to break out the Parts object to separate objects or layers for Deactivation to work. A Parts object rarely settles completely on its own and the Deactivation feature does not work on a Parts object at all, probably because some part of the Parts object is always tumbling through infinite space or constantly colliding with itself. For it to settle with itself, every single part needs to stop moving or self colliding.

Using Parts is a convenient short cut but it does introduce some complications. In many production shots I've worked on, I find the post jittering often doesn't matter because the action is editorially cut long before you see the errors.

However, if you really do need to show the sim all the way to the end, it's better to break out your geometry to separate objects and make the simulation easier for Bullet to calculate. When the objects are separated like this, Deactivation can be evaluated individually per object basis.

G.

MonroePoteet
09-19-2015, 10:00 AM
Thanks for the great info on the Bullet simulation frame rate (NOT the scene frame rate, but in the Bullet Item Properties=>World tab), deficiencies in the Parts type object handling, etc. I'll definitely try some of my previously failed simulations with the higher frame rate. In the gumball case, does prevent the balls from going through the floor, which was a Box type Static object all along but the lower frame rate apparently missed the collision fairly often. With the higher frame rate simulation does take longer, but certainly seems more accurate. I'll be interested in re-trying my pool table simulation with the bumpers, caroms, ball spin, etc. with this new info.

mTp