Bullet Physics and C8.5
So for some reason I decided to try some physics based animations. I've noticed a few problems with it and I'm hoping someone has advice. This is with C8.5-172 on OSX. An earlier version of the animation I refer to in here can be see here. Please note that I refer to timings with respect to Carrara's timeline -- this is a 24 fps animation but is rendered as a sequence and I used a rather lower rate (I forget what exactly) when making the movie so the timings differ.
The main issue appears to be repeatability. You set up a piece, do calculations, fix what needs fixing, add more, calculate again and... I don't know this for a fact but it *appears* that re-calculating is cumulative, at least in some sense. I've been too busy fighting with Carrara in an attempt to get things working to setup a completely clean test for this however so it is all supposition on my part. But as an example, in the animation the ball rolls down the chute faster on subsequent recalculations. Too a point. It has varied from about 5.5 seconds scene time to less than 4 seconds.
The second ball (fixed now, I hope permanently) was tweaked (via mass ratio with the first) to just hit the block at the top of the ramp. However, it started hitting it harder and harder. I gradually reduced its mass to find the new working spot and eventually succeeded -- close to where the mass setting had started.
Another issue, possibly related to an incremental accumulation of multiple calculations, is instability. Items are are placed exactly on the surface and I'm currently using a collision distance of 10%. This has, for the most part, produced good results, but *some* objects decide to jitter. Its a minority of them, but it persists with a few that are particularly important that they not.
I've had strange problems where an object would *immediately* (frame 1, the first calculated frame) drop through the surface on which it rests resulting in it being half submerged. In subsequent frames the collision detection would step it out and on top. In trouble shooting this I rotated the object 90 degrees so that it's "bottom" faced behind it. Subsequently, it popped backwards the same distance. No matter what I changed in settings and calculated this one instance always did this. Converting it to keyframe motion, deleting all key frames, and switching back to physics motion cured it.
I've subsequently tried that method on other problem objects with varying degrees of success. One of the previously mentioned trouble areas this stopped the immediate problem, but after several recalculations (trying to get other things lined up correctly) it now has the same net effect, it just takes longer to happen.
If you add Soft Body modifier there is a button to simply delete all calculations -- I cannot find an equivalent for those that are just rigid body. Is there a better way to clear calculations? Is it relevant?
None of what I have done has been methodical to test for behavior, rather it is methodical to try and complete the animation. Some factors that have come into play are Carrara crashing so it is possible that some of the inconsistency in physics calculations have to do with whether or not it is in the same run session. I'd be disappointed if that were the case, but it strikes me as a significant possibility.
Comments
well... i've gotten closer to completing this and have a couple more observations.
1. Extraneous movement appears to be part and parcel of bullet physics. It might (or might not) affect any given physics object during any given calculation -- but once it starts it is persistent. Switching motion to key frame will (in some cases) reveal extraneous key frame data that can be deleted. That's when you're lucky, because it doesn't always work.
2. Switching motion to still and back to physics has no effect on the problems.
3. After quite a bit of this I have discovered that clicking into the timeline is a sure ticket to a crash. It might not happen on the first click (though often enough it does), but it *will* happen -- I don't think it has ever taken more than three clicks.
The best system I've come up with to work with physics is to follow this method after the project has been created, but before doing *any* calculations:
1. Open scene
2. Make changes
3. Save
4. Calculate
5. If changes are needed close scene
Following this does *not* eliminate weird things from happening, but it does help to minimize them. Closing Carrara as a step 6 has not been thoroughly tested, but does not appear to be necessarily for a (mostly) functional way of working.
With settings well established on the first ball (its density, initial velocity, friction, etc.) I found that it would hit the turnstile at the bottom of the chute at exactly 5s. I got a calculation that I could've lived with, forgot to save (as a new file to avoid poisoning the working one) and clicked in the timeline. Oops. So I restarted Carrara and run the calculations. I wasn't able to observe too closely, but the ball hit the turn stile well before 5s and the second ball was already at nearly the top of the ramp at 6s. So I closed and re-opened and tried again. Same thing. So I closed/opened and reduced the initial velocity. The first ball hit the turn stile at exactly 5s.
There's something decidedly variable in a persistent way. Things will follow a certain path, but only so many times/for so long before diverging. I can understand the final state of the scene being somewhat variable given the large number of components if there is *any* fuzzing going on, but without changing settings sometimes the second ball will fail to reach the top of the ramp, other times it goes flying over the top knocking the block set there out of its way. (It was actually pretty cool, it jumped the third ball, landed in the chute and was followed down it -- I wouldn't have minded keeping that flow, but it quit happening while changing parameters for things that came after it.)
The point is that the results are *highly* variable and not particularly consistent.
One final observation: the view is updated as the calculations proceed -- unless Carrara loses and regains focus. I'm not sure why that is, but it makes it awkward. I try to keep an eye on the progress so that I can cancel it if things are obviously not working (a stationary object teleporting halfway into another one, sudden jumps in velocity or inertia) without having to wait for the entire calculation to complete. Currently a render is about 0.7 seconds per frame, but calculation varies from 2 to 20 seconds per frame.
I'm not sure what is going on to cause this, but it is annoying. The latest occurrence (current calculation, actually) was a system dialog popped up causing an immediate loss of focus and when dismissed focus was restored to Carrara.
For what its worth I've updated the WIP render at the original link. Once I get a good calculation I'll save the scene (with a new name...) and do textures, etc.
Keep in mind that, although very good, Bullet is a game engine physics sim and is not intended to give a real world one to one correlation.
It is very dependent on the processor time that it's given. Also the objects that it's working with are very 'granular', so, as it's going through it's loop, the object surfaces can be in different positions for each 'tick'. Any small changes to the scene can affect things in unpredictable ways, as positions can be different when it gets around to dealing with each object, even if they're not interacting. Not having anything going on in the background can help. The bulletphysics.org website makes for interesting reading.
Interestingly, you're actually seeing something akin to quantum physics, where nothing is 100% predictable. If you averaged everything out over a few billion billion simulations you'd probably get a real world sim.
thanks for the reading link, I'll have to do that. While having fuzzing is desirable some of what I've observed goes way beyond that. Some of the differences are not minor or reasonably attributable to expected variation. When all parameters are identical it simply isn't reasonable to have a 20% variation in time for a short roll down a reasonably smooth chute. It isn't reasonable that a object with a given mass striking another with a given velocity in a given spot would have a greater than 20% variation.
So I differ about taking a lot of runs and getting a "real world sim" unless I misunderstood you. A billion sims would most likely, from the sampling I've seen, get you at least a million significantly different results -- and that's assuming you have only a very small number of moving parts and the total interaction is less only a few seconds.
One of the things I've noticed is that the behaviors go in spurts. I've gotten three to five calculations with consistent (albeit somewhat variable) results -- then the next will be off the deep end in some direction. Changing density from 30 to 120 to get the same result after one of these shifts is a *huge* difference.
And, the thing about quantum mechanics is that it operates at... the quantum level. Newtonian mechanics is a perfectly reasonable model for the physics being used in anything remotely close to human measures (e.g., you don't build objects at a molecular -- much less subatomic -- scale in Carrara, nor do you have scenes with distances measured in parsecs). If it was a "perfect" newtonian physics simulation there'd be realism issues due to the objects being too perfect. You don't normally encounter perfect 90 degree angles in the real world, or perfectly flat surfaces.
Without knowing just how bullet works, I mentioned fuzzing because it is *desirable* to have some random element at work to cover the perfections of the models with imprecision.
All that said, the *most* frustrating part of this is without a doubt the crashing. I think I finally got my final calculation. The one before it crashed as soon as I tried to replay (just a check to see if it was good or not before saving). I could check the OS X logs to see just how many crashes I've had over the last week but it is *far* more than normal. Using physics calculations definitely makes Carrara unstable with respect to the timeline. Most any action in the sequencer can result in a crash after doing just one.
I suppose I could update my WIP movie with the current calculations, but not only do I need to head to bed, I also am going to have to correct the camera (what I have was for a different timing of events when 'it worked' with slower motion and it just stops at a previous maximum time) to keep the action in view. And the current shaders are just stand-ins.
I did catch myself doing some useless work that is perhaps worth pointing out. To avoid unwanted side effects from balls and blocks winging their way around the scene I set up some catchers. The waste was trying to size and place them for what I wanted. Since they aren't physics controlled I just need them to be in the way. Exact size/placement can be anything that fits the need of the final calculation. Heck, they could be deleted from the scene now if I wanted that.
The takeaway from that is don't worry too much about *exactly* how non-physics objects are placed or sized.
Oh, another item was how to deal with the variable stability. Towards the end of the render I had one "house of cards" that stood for 20+ seconds -- until I got the earlier part working correctly. Then it would collapse in under 3 seconds (for what its worth it isn't in play until around 14s). What i did was to create "helper" objects -- once I knew fairly well what time it was going to be in play I put "stabilizer" objects (keyframe motion) blocking each of the problem physics components. Then a discrete tweener was used to move them out of the way ~0.5s before impact.
Its the virtual equivalent of putting a finger on a beam to steady it -- with the advantage that the finger won't even be in the final scene when I do render.
Thanks again for the pointer to reading on bullet.
Hello to all,
I am just testing bullet phis. in C8.5, so I wanna share with you this file including the dynamic cloth, provided by PhilW in another thread - waved by the wind; more or less this setting should work nice for a shroud or a cloak; look at the following parameters in particular. hope it helps.
http://www.adrive.com/public/UjNGkk/PinaforeDress1.car
Thanks for sharing!
The last physics based thing I was working on was soft body and I could not get the attach to work at all -- not even a simple flag blowing. The last time I did soft body attach was during the initial beta inclusion and the interface doesn't even match up to what I remember seeing. Any pointers on getting that to work?
Very cool thread. It's about time I start messing with this. Thanks for starting this, Thoromyr.
Also, Thanks for your contribution, Rogue Pilot and magaremoto.
magaremoto,
I looked closely at your screenshots, paying close attention to the circled stuff and the one underline. Thank you. I was about to ask about the column, and how it is attached to the dress - when I just decided to download the file, instead. Again... thank you. I hope I can figure it out from here.
In what Rogue Pilot mentioned about stuff going on in the background, I have noticed that dynamic hair can have completely undesirable results if you have a sky dome or other background activities during the simulation calculations. Simply omit any of that stuff until after you've saved out a simulation that you're happy with. For best results in that regard, I'd have an entirely empty scene, except for what is necessary for the simulation - then save that simulated result - which you can add to without grief ;-)
PhilW, thanks for the Kickin' Dress! Can't wait to see it fall off... I mean... simulate, realistically on Rosie! :)
dunno, it works fine to me, all I would suggest is to avoid the default gravity - as in the first shot - and see what happens, then, after selecting some vertices with the brush, validated and attached to an object, starts with a low force strenght. The attachment should hold out. The only thing I have never had to set up is the soft body attach, responsive from the beginning :cheese:
Bullet is powerful in carrara indeed and as far as i can see, it works even with magnets and modifiers
edit: @ thoromyr
re-edit: @ dartanbeck, as you can see in the file the pole is simply near the cloth, all the rest is by the soft body attach modifier. I guess if parameters are set up right, bullet works in carrara
thanks for the reply! I got another via PM as well and i'm about to give it another go.
Why is your collision set so high? I never set it above 5%.
I have various issues with soft body. At the top of my list is it giving you a brush for doing the soft body pinning that would work better for painting a building and no way to adjust it to a workable size. I gave up even trying to use soft body pinning.
I can't wait to try it out. I have to pass out now. Maybe when I awaken later, I'll get the stamina to try this out.
btw, have you tried using the dress on a character? Do you know which character it's for, or which post you've found it in?
Please don't reply to any of those questions if they are a PITA - as I can dig that all up myself. Only if you know of the top ;-)
All of you.
Thanks for this. I've been meaning to play with Bullet but I keep getting side-tracked.
well I assume this is the best choice for C developers so I digit this input at first, then it may vary if I am not satisfied with it; this is a quick test and can be set up at best
I usually range over 1 and 2 for the brush size and use the remove button a lot ; ;-P
I can't wait to try it out. I have to pass out now. Maybe when I awaken later, I'll get the stamina to try this out.
btw, have you tried using the dress on a character? Do you know which character it's for, or which post you've found it in?
Please don't reply to any of those questions if they are a PITA - as I can dig that all up myself. Only if you know of the top ;-)
All of you.
Thanks for this. I've been meaning to play with Bullet but I keep getting side-tracked.
that's partially correct DB; actually this test is conceived to find the right parameters for a cloack I bought @daz that I want to be moved in a walk cycle; the pole represents the character's shoulders. Now I can almost state that bullet can work on some clothes if you act on bones (or weights if you prefer) in the animation mode tabs; doing so, I think you remove some constraints, and bullet does its job. I can be more accurate in a couple of days anyway
Now... If I'm reading this right, I'm wondering what it would be like to make a partial dynamic effect. We'll see where this goes. I have a feeling that, like dynamic hair, once the sim has been calculated, you can do what you want with the scene afterwards. So just save off the sim of, say, a flag from a pole that was once in the hands of a marching soldier - to get the motion of the pole correct - so that it can be loaded in any scene where you might need a soldier walking, with a flagpole out in front of him - just for one example.
I was also kicking around the idea of trying to make a new type of hair that behaves like cloth. I'm wondering if stands (more: lengths or curly strands, held in shape by verts that don't render) could in turn be even more held to a complete wig of wefts of specific enough properties to get a more realistic sim of curly, long hair. (?)
Now... If I'm reading this right, I'm wondering what it would be like to make a partial dynamic effect. We'll see where this goes. I have a feeling that, like dynamic hair, once the sim has been calculated, you can do what you want with the scene afterwards. So just save off the sim of, say, a flag from a pole that was once in the hands of a marching soldier - to get the motion of the pole correct - so that it can be loaded in any scene where you might need a soldier walking, with a flagpole out in front of him - just for one example.
I was also kicking around the idea of trying to make a new type of hair that behaves like cloth. I'm wondering if stands (more: lengths or curly strands, held in shape by verts that don't render) could in turn be even more held to a complete wig of wefts of specific enough properties to get a more realistic sim of curly, long hair. (?)
Hello DB, I did my homework, so: yes you can save the sim and use it in another scene; hair like cloth? That's an interesting challenge, I'll give a try ;-)
Now, let's focus on the subject:
http://youtu.be/VOkDvCOwqsk
these are some samples, I tested the bullet physics on two daz contents, a cloak and a top, well it works fine as long as you: - delete the constraints that fossilises the movement, clean the mesh reducing the polygons, changing the triangles into quads and eventually eliminating the holes between the polygons. you can do that in hexagon or Accutrans for example. Unfortunately you lose the fitting with daz characters but you can parent them
Looking good!
Dog gone it! Everyone wants me to fix their yards. By the time I get home I'm too brain dead to touch Carrara. Did you see my post where I though I saw sun rays in the fog? That's the king of illness I'm dealing with. Too scared to see a darned doctor about brain-stuff. CT scans go for, what $6 - 10,000 now? That's a lot of stone to cut!
All I have to say is http://www.youtube.com/watch?v=rmHDhAohJlQ
Can you convert the bullet sims back into keyframes like in the native physics engine? I like doing that if I have unexpected weirdness at the end of a simulation. Just delete the keyframes you don't want!
well, if I understand, what I'd do in your case is to import a specific object into a file with the pre-set bullet physics animation inside, and apply the force to that object; this is why the behaviour of the force you choose is strictly related to the gravity you define in the physics tab of the scene. Of course you can also apply modifiers of other similar items already set.
other sims on the nightguard cloak:
http://youtu.be/vsol2EmNy4M
well, if I understand, what I'd do in your case is to import a specific object into a file with the pre-set bullet physics animation inside, and apply the force to that object; this is why the behaviour of the force you choose is strictly related to the gravity you define in the physics tab of the scene. Of course you can also apply modifiers of other similar items already set.
other sims on the nightguard cloak:
http://youtu.be/vsol2EmNy4M
Nope. No case. No Bullet for me. I'm still using C7.2 Pro. It's just a question.
I was just asking if it was possible to convert the Bullet simulation to keyframes as it is with Carrara's built-in physics engine. Bullet sounds great, but it sounds as if it still has issues with unexpected results. The way I look at it, is if the anomaly is at the end of the animation, you can delete the keyframes for the un-wanted movement. I've also read about jiggling and vibrating objects prior to the main simulation, so you could delete those keyframes leading up to the main action to eliminate it.
HI Evil Producer :)
Yes,. you can convert the simulation to key-frames,. just change the motion type after running the simulation.
You can also create a softbody simulation,. and export the object at any frame,.
For example: if you wanted a table cloth which is already draped.
since that exported / imported OBJ table cloth could still be used as a physics object,. you could apply a flow force to create a breeze effect.and since it's Pre-draped over your table,. the new simulation would only really effect the overhanging edges.
hope that makes sense :)
Thanks Andy! When I get the filthy lucre to update to C8.x I will have to experiment with Bullet.
About unexpected results, like I' ve posted above, I think it's mainly due to constraints and to something that inherits meshes; if you export a mesh in obj format, convert triangles in quads, and decimate as well, bullet should work in most cases, so I guess it's the original mesh the main problem. In all my 5-days sims this method has been always a winner
a flow force and a directional force applied to the cloak. It works :ohh: :coolsmile:
http://youtu.be/uj4d8MO_pMI
very cool! Maybe one of these days I'll get back to trying clothing sim. Its results like this (and the tips in this thread) that make me want to keep trying.
Hmmm. Interesting. I thought conventional (poser) wisdom was to use lots and lots of triangles...(?)
but Bullet is so different that all the old Poser pret-a-sim fashions are not going to work...?
thank you thoromyr, actually bullet on clothes is not as easy as it looks, but it's worth give a try, keep in mind the screenshots I uploaded: gravity + force strenght, density and stiffness among other parameters matter IMO.
Holly, the dress by PhilW speaks for itself; no triangles, few quads and general neat mesh: the more the polygons the more the nodes computation IMO
another quick try to achieve a walk cycle oscillation:
http://www.youtube.com/watch?v=gjCZcWK-Mmw&feature=youtu.be
hello again,
my latest sim where bullet, a magnet and a punch modifier have been applied simoltaneusly; the punch modifier is being greatly influenced by the magnet: you can translate and increase it by moving or scaling magnet components. amazing carrara!
http://www.youtube.com/watch?v=m8K8oVW30jY&feature=youtu.be
looks fun!
It really is! It seems you may have bullet, magnets and modifiers acting on the same object and working together without virtually any conflicts. Working on my 8core the simulation is fast enough too. The amazing fact is the punch mod enahnced by the magnet, I wouldn't have supposed that