Saturday, August 7, 2010

Bullet SoC - Winds of Charge

After a bit of a development hiatus due to some unforeseen troubles in trying to get the Manipulator API up and functioning (as of time of writing this, they still haven't been resolved), it's time for some new cool stuff and updates here again. So while I'd have liked to get the Manipulator API finished during/as part of this year's SoC, it looks like it wasn't meant to be...


The eagle-eyed among you may have noticed:
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31128
(i.e. revision 31128)

This commit basically adds support for using Blender's "Force Fields" in Rigid Body simulations. They are a way of allowing you to "sculpt" the simulation result. Here's a little illustration of effectors in action:
Before (running simulation)
After (while simulation is running)
For now, this will have to suffice as a demo of this functionality. The items highlighted in orange are the effectors, while the ones in green are the Rigid Bodies being affected by them. There are also particles being emitted by the deselected cube (not part of the Rigid Body simulation) which are there to illustrate the effects of the effectors as they should be (when working correctly).

Disappointingly, the results in motion are still not visible enough to show in a video yet, even though I'd have loved to set up one to show this off now. Maybe later on when it works better I'll make that demo vid. Oh, and it seems that it's probably time that I exposed some more controls for dealing with the deactivation thresholds/etc. since it seems that those are causing a few unsightly/unexpected glitches in the results of many of these recent experiments.

In the meantime, go out and have fun with these new toys :)



[EDIT: 5:50pm]
For those curious about how this works, here's a little overview:
Blender already has a unified system for handling effectors. Basically, it takes all the effectors you're worrying about, and determines the "net force" (i.e. consider it grabbing a bunch of arrows pointing in different directions, mushing that together, and getting a single big arrow pointing in the direction that the combination of arrows were pointing before) for each "particle"-like entity it is asked to determine this net force for. This is then simply fed into Bullet as an external force that gets applied to the Rigid Bodies for whatever reason (the same thing happens with the other sims too AFAIK).

For anyone who's looking at implementing such support for another physics sim in future, have a look at rigidbody_update_sim_ob() in blenkernel/rigidbody.c, particularly the first block only (/* update influence of effectors - but don't do it on an effector */) as in the linked commit. I can't guarantee it'll still be there in later revisions, though it most likely will stay put :)

~~~

Also, while testing that earlier file again with a different build, I've been able to get things working quite nicely for a demo. So, without further ado, here's that file (shown in the screenshots above):
http://www.pasteall.org/blend/3347

And as promised earlier, a video demo of this in action :)
http://vimeo.com/13954183

Remember, you'll need one of the latest builds of my SoC branch to get that to work.

4 comments:

  1. Looks promising!
    Continue your excelent work.

    ReplyDelete
  2. Great developments Aligorith! Thanks for all your efforts.

    Demohero.

    ReplyDelete
  3. Thanks for your work, it's very exciting.
    I'm wondering if physics could be used with particles systems too?
    E.g make a particle system that would emit some cubes that have physicall properties (collision).

    ReplyDelete
  4. isn't a rigid body less complex than a cloth/softbody? wouldn't it be simpler to use a native rigid body edition to the non realtime simulation set, than to water down the forces inputs for realtime bullet?

    ReplyDelete