bullet physics for DS 1, 2, 3, 4 PC/Win ... teaser

1246711

Comments

  • RAMWolffRAMWolff Posts: 10,146
    edited December 1969

    I have no idea what you just said except for the last line! lol

  • mCasualmCasual Posts: 4,604
    edited December 1969

    RAMWolff said:
    I have no idea what you just said except for the last line! lol

    the low down is

    you will be able to install a hinge ( which may be a car axle by the way ) without having to mind how the door / wheel is positioned

    clack.gif
    512 x 512 - 143K
  • Design Anvil - Razor42Design Anvil - Razor42 Posts: 1,234
    edited October 2013

    This is awesome, if you can briing bullet type physics into Daz you'll make a lot people happy! Including me!
    Epic work! Be great to see a mac version tho.

    Post edited by Design Anvil - Razor42 on
  • ghastlycomicghastlycomic Posts: 2,528
    edited December 1969

    Me three!

    I'd love to have bullet physics in Daz.

  • mCasualmCasual Posts: 4,604
    edited December 1969

    Amy yet again serene and completely confident in the safety of the experiment pertaining to hinge2Constraints

    confident.jpg
    1024 x 1024 - 642K
  • RAMWolffRAMWolff Posts: 10,146
    edited December 1969

    I don't know, looks dangerous to me! YIKES!

  • edited December 1969

    hey Casual, just came across this, and it's fascinating to watch the process you're going through. i'm new to DAZ, DS and 3D modelling/animation, but i'm sort of generally aware of toolkits and libraries, etc for game engines. what you have looks pretty good to me.

    i'm on a Mac, so i'm interested to know why exactly what you did is PC/Win only. as far as i know you can incorporate external libraries via the SDK on either platform. so, are you doing any of the following?

    1. using a bullet physics engine library compiled for PC, and most of the scripting/configuration is scripted inside DS, or

    2. are you using a PC-based toolchain and script setup (Javascript?/Python?/.NET?) and then just calling the engine within DS?

    3. something else?

    either way, it doesn't look trivial, but i'd be curious what porting it to Mac would mean in terms of the code requirements.

    keep it up - excellent start you have!


    scott

  • mCasualmCasual Posts: 4,604
    edited October 2013

    thingy564 said:
    hey Casual, just came across this, and it's fascinating to watch the process you're going through. i'm new to DAZ, DS and 3D modelling/animation, but i'm sort of generally aware of toolkits and libraries, etc for game engines. what you have looks pretty good to me.

    i'm on a Mac, so i'm interested to know why exactly what you did is PC/Win only. as far as i know you can incorporate external libraries via the SDK on either platform. so, are you doing any of the following?
    1. using a bullet physics engine library compiled for PC, and most of the scripting/configuration is scripted inside DS, or
    2. are you using a PC-based toolchain and script setup (Javascript?/Python?/.NET?) and then just calling the engine within DS?
    3. something else?
    either way, it doesn't look trivial, but i'd be curious what porting it to Mac would mean in terms of the code requirements.
    keep it up - excellent start you have!
    scott

    the "client" is a daz script (very javascript-like ) it can mark objects in the scene as being static or dynamic bodies or constraints
    , it can compute their mass. Physical bodies get new properties in their parameters tab, ex: hinges get a drop down list to select which objects are attached to the hinge.

    then the script can package all that information and place it in a file named in.txt

    ---

    for the 'server' ( more like a processor for now )

    i copied the big Visual Studio 2010 C++ solution, that comes with the Bullet Physics sdk
    i stripped everything except support for collisions, dynamics, linear maths
    the program gets the Daz Studio physical scene as a text file (in.txt) that looks like

    
    0 Cylinder1 0 0 0 0 0 0 0.707 0.707 0 0.01 0.25 0.01 121 
    0 Cube1 27 0 -0.653 -0.762 -0.343 0 0 0.939 0 0.15 0.15 0.15 121 
    0 Cylinder3 0 0 0 0.5 0 0 0.707 0.707 0 0.01 0.25 0.01 121 
    0 Cube2 27 0 -1.001 0.494 0 0 0 1 0 0.15 0.15 0.15 121 
    2 Cylinder1 1 0 0.009 1.003 -1 0 0 
    2 Cylinder3 3 0 1.001 0.006 -1 0 0
    

    it creates (instantiates) in the bullet physics world the objects in that list at the positions specified
    in this example there's 1 static body 2 dynamic bodies and 2 hinges

    it runs the simulation for the number of frames specified ( 121 )

    and writes the results in a text file (out.txt) which looks like

    
    body Cylinder1 static
    body Cube1 dynamic
    body Cylinder3 static
    body Cube2 dynamic
    0 0 0.000000 0.000000 0.000000 0.000000 0.000000 0.707107 0.707107
    1 0 0.000000 -0.656674 -0.759261 -0.345072 0.000000 0.000000 0.938576
    2 0 0.000000 0.000000 0.500000 0.000000 0.000000 0.707107 0.707107
    3 0 0.000000 -1.001496 0.494033 -0.000017 0.000000 0.000000 1.000000
    0 1 0.000000 0.000000 0.000000 0.000000 0.000000 0.707107 0.707107
    ...
    3 119 0.000000 -0.897749 0.056050 0.224813 -0.000000 0.000000 0.974402
    0 120 0.000000 0.000000 0.000000 0.000000 0.000000 0.707107 0.707107
    1 120 -0.000000 -0.952922 -0.314600 -0.582578 0.000000 0.000000 0.812775
    2 120 0.000000 0.000000 0.500000 0.000000 0.000000 0.707107 0.707107
    3 120 0.000000 -0.893711 0.047989 0.229199 -0.000000 0.000000 0.973380
    

    once the simulation ends the Daz Studio client script reads out.txt and animates the specified objects

    --------

    the daz studio script would run on a Mac without modification

    i'll almost certainly publish my source code so it wont be hard for any volunteer to compile it for a mac

    -------

    later i may make a real-time version, since daz studio scripts can establish sustained communication ( stdin/stdout) with external programs

    if you look at https://sites.google.com/site/mcasualsdazscripts/mcjwiikit-for-daz-studio-3-pc-version-zero-beta-not-stable-yet
    that's how i allowed real-time control of daz studio with a wii-mote
    also see https://sites.google.com/site/mcasualsdazscripts2/mcjhidkit for gamepads

    eventually i may make a plugin for DS4 and DS3 which will be more responsive

    rolling.jpg
    1280 x 720 - 181K
    soki.jpg
    281 x 755 - 48K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited October 2013

    currently adding "Hinge 2" constraints

    steer and roll with a suspension !


    in ODE it's called "A hinge-2 joint"

    http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions

    in Bullet Physics ot's a btHinge2Constraint

    http://bulletphysics.org/Bullet/BulletFull/classbtHinge2Constraint.html

    il_fullxfull.396909686_lvrt_.jpg
    720 x 807 - 145K
    Hinge2.jpg
    400 x 300 - 14K
    Post edited by mCasual on
  • edited December 1969

    wow Casual! that's pretty amazing and awesome, i have to say, and it's a good idea to start the project out by offloading processing to a separate app and then send the results back to the Animator in less than real time. overall though it should still be pretty responsive as long as someones not trying to model 3000+ Tenga blocks crashing down. as you refine it you may be able to make it efficient enough to run it in real time with good performance, but it's better to start small and manageable and grow from there.

    although i'm not a programmer i understood most of what you're up to. i've never yet compiled anything on the Mac, but i'm definitely getting closer to a point where i'll need to do it. one curious thing for those of us on Macs (and for anyone scared of compiling from source) would be if you could call an emulated version of your Win based app from Daz on a Mac via scripting. i've been able to wrap a number of Win apps up in a standard OS X bundle through Wine and Wineskin - like BVHacker for instance which just _barely_ runs (don't resize the program window or you're doomed). so it makes me a bit curious if a script could call an emulated EXE directly. it's certainly possible to copy a text file within a MacOS bundle and have the emulated program believe it's in the filepath of a Windows machine. so as long as the filepaths were logical to each platform, it would be pretty easy to import the data from within a Wineskin.

    anyway it sounds like a really promising plugin. thanks a huge amount and i'll look forward to working with it when i have some time.

    scott

  • mCasualmCasual Posts: 4,604
    edited October 2013

    Amy ... not afraid
    a nice scooter looks more interesting than boxes and cylinders
    .
    .
    .

    i realized just now i didn't really make this scooter steerable

    inclined.jpg
    1024 x 1024 - 243K
    axis.jpg
    1024 x 1024 - 430K
    jjump.jpg
    1024 x 1024 - 228K
    go_on.jpg
    1280 x 720 - 157K
    notafraid.jpg
    1024 x 1024 - 186K
    Post edited by mCasual on
  • Eustace ScrubbEustace Scrubb Posts: 2,687
    edited December 1969

    Casual said:
    Amy ... not afraid
    a nice scooter looks more interesting than boxes and cylinders
    .
    .
    .

    I realized just now i didn't really make this scooter steerable


    So THAT'S why she's riding off the edge in the fourth picture!
  • mCasualmCasual Posts: 4,604
    edited October 2013

    Casual said:
    Amy ... not afraid
    a nice scooter looks more interesting than boxes and cylinders
    .
    .
    .

    I realized just now i didn't really make this scooter steerable


    So THAT'S why she's riding off the edge in the fourth picture!

    she's taking all those risks for Science ( and the public good or something )

    zipo.jpg
    985 x 435 - 94K
    shome.jpg
    1024 x 1024 - 344K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited October 2013

    rough ride for the first simulation of the "hinge 2" constraint ( steer, roll and shock absorber )

    it just needs stiffer shock absorbers :)

    somewhat.jpg
    480 x 480 - 50K
    bike1.gif
    480 x 480 - 552K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,604
    edited December 1969

    not sure yet why the wheels lock

    i know that for cars and the likes, bullet suggests we don't use hinges ,

    rather use "ray-Casters" meaning the car slides above ground, supported by invisible rays
    and i guess, bullet spins the wheels according to the movements

    bike2.gif
    480 x 480 - 635K
  • mCasualmCasual Posts: 4,604
    edited December 1969

    i made the bike frame heavier
    the rear wheel wider ( wider than shown )
    and it looks like it did the trick

    i'll give users access to most of the hinge parameters
    since default values are not enough to make things work out

    bike3.gif
    480 x 480 - 664K
  • patience55patience55 Posts: 7,006
    edited December 1969

    That's working better :-)

  • mCasualmCasual Posts: 4,604
    edited December 1969

    note that this, albeit simple, 4 seconds/120 frames simulation takes 2 seconds to compute
    so eventually if we go real-time, we could play GTA0 in DS

    bike4.gif
    480 x 270 - 138K
  • mCasualmCasual Posts: 4,604
    edited December 1969

    new setup for upcoming development

    4 the initial release may include support for non-primitives ... say low-poly terrains etc

    stuntramp1.jpg
    1280 x 720 - 141K
  • mCasualmCasual Posts: 4,604
    edited October 2013

    Amy's death defying jump demonstrating Hinge-2 constraints !

    http://www.youtube.com/watch?v=vuYMvRh8iGg

    also see the giraffianesque version

    http://www.youtube.com/watch?v=ZSxLUgnbj8M

    walkinthepark.jpg
    1280 x 720 - 146K
    dd.jpg
    1280 x 720 - 239K
    Post edited by mCasual on
  • patience55patience55 Posts: 7,006
    edited December 1969

    You realize of course that she'll be asking you for danger pay soon ;-)

  • mCasualmCasual Posts: 4,604
    edited December 1969

    You realize of course that she'll be asking you for danger pay soon ;-)

    she may need a protective dangerfield

    or at least a helmet

    ( that's actually Nicole Kidman in the 1983 BMX Bandits )

    bmx-bandits-nicole-kidman.jpg
    600 x 356 - 108K
  • patience55patience55 Posts: 7,006
    edited December 1969

    There goes the hairdo lol ...

  • mCasualmCasual Posts: 4,604
    edited October 2013

    the physics tests will look better with a brand new bike

    soon ( but not that soon ) i'll probably post the bike on my site

    dabike.jpg
    1920 x 1080 - 438K
    sane.jpg
    1920 x 1080 - 311K
    nubike2.jpg
    1280 x 720 - 184K
    amysshinynewbike.jpg
    1920 x 1080 - 282K
    Post edited by mCasual on
  • patience55patience55 Posts: 7,006
    edited December 1969

    Casual said:
    the physics tests will look better with a brand new bike

    soon ( but not that soon ) i'll probably post the bike on my site

    Oh that's a nice new prezzie for her.

    {not to worry you but the uh, giraffe is growing!}

  • mCasualmCasual Posts: 4,604
    edited December 1969

    Casual said:
    the physics tests will look better with a brand new bike

    soon ( but not that soon ) i'll probably post the bike on my site

    Oh that's a nice new prezzie for her.

    {not to worry you but the uh, giraffe is growing!}

    in the early pics the giraffe was as tall as the ramp then later on it was looking smaller, so i unshrunk it :)

  • mCasualmCasual Posts: 4,604
    edited December 1969

    Amy's bike promo teaser video YT

    https://www.youtube.com/watch?v=VNeHLTwfYmQ

    bikesho.jpg
    1280 x 960 - 155K
  • mCasualmCasual Posts: 4,604
    edited December 1969

    so far in the test cases
    physical bodies were made of boxes ( or cylinders, spheres, cones, capsules )
    now i'll introduce the "triangle meshes"
    so you'll be able, for example, to specify that a shirt is a physical object
    or that a terrain ( google/youtube-search) for mcjElevate is a physical object
    only non-moving objects will be supported for this script version

    in the inage below the green surfaces will be our test "triangle mesh"

    and Amy is still on board for the experiments with her brand new unchained bike

    surfacer.jpg
    1920 x 1080 - 2M
  • mCasualmCasual Posts: 4,604
    edited December 1969

    see see ?

    exactly like the movie 'Contact'

    ok maybe not exactly

    contact.gif
    180 x 360 - 187K
  • mCasualmCasual Posts: 4,604
    edited November 2013

    the moment many-a-few have been waiting for

    the physics server became aware of the existence of the green triangleMesh

    meaning terrains will be supported ! mountain roads !

    and meaning the video where Amy rides her bike don't the ramp is nigh ( ish )

    manyafew.gif
    600 x 337 - 225K
    Post edited by mCasual on
Sign In or Register to comment.