Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: Simple fluid simulation  (Read 27387 times)

NickE

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Simple fluid simulation
« on: June 12, 2009, 08:34:38 pm »

I have been experimenting with trying to simulate fluids using Anim8or:

 youtube.com/watch?v=nRbhXJUqyC4[/youtube]]http://www.


The water is a single mesh.  No morph targets were used.  The scene contains only a single copy of the water mesh object and the container mesh object.

Any guesses on how it was done?
Logged

3D Joe Wiltshire

  • Sr. Member
  • ****
  • Posts: 728
  • Winter's Coming :O
    • View Profile
Re: Simple fluid simulation
« Reply #1 on: June 12, 2009, 09:32:40 pm »

... I have no idea... but I LOVE YOU!

kidding lol, very nice! would love to see it in dielectric :)
Logged

Ratticis

  • Jr. Member
  • **
  • Posts: 86
  • NOW WITH 90% MORE AWESOME!
    • View Profile
Re: Simple fluid simulation
« Reply #2 on: June 13, 2009, 01:14:46 am »

What kind of sorcery is this?
Logged

Arik_the_Red

  • Sr. Member
  • ****
  • Posts: 785
  • Just another aninoob...
    • View Profile
    • æwakened!
Re: Simple fluid simulation
« Reply #3 on: June 13, 2009, 02:47:30 am »

Yo that was cool! I'm holding my wife's pet guinea pig hostage, a freshly sharpened blade of grass to its jugular until you share your secret!

And how would that work with raytrace?
« Last Edit: June 13, 2009, 02:50:12 am by Arik_the_Red »
Logged

lynn22

  • Sr. Member
  • ****
  • Posts: 591
    • View Profile
    • 3D Animation
Re: Simple fluid simulation
« Reply #4 on: June 13, 2009, 02:58:01 am »

No idea on how it was done but the result is splendid.
Logged

headwax

  • Sr. Member
  • ****
  • Posts: 600
    • View Profile
    • Headwax's Website
Re: Simple fluid simulation
« Reply #5 on: June 13, 2009, 04:42:15 am »

Pretty amazing,

I'm going to guess you used 9000 bones and had a valve computer the size of a small laundry :)
Logged

NickE

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Re: Simple fluid simulation
« Reply #6 on: June 13, 2009, 09:47:24 am »

It turns out that Anim8or is full of surprises.  Did you know that object scripts run asynchronously to the rest of the program, and that scripts continue to run even if you change from object mode to scene mode?  Neither did I, until recently.

I have been playing with writing scripts to simulate fluids and was watching the evolving fluid simulation in object mode.  I was trying to figure out how I could possibly render the simulation.  The possibilities were:

1) Calculate all the frames as separate objects and manually (or by outside program) insert them into a scene, like you have to do to insert video into an animation.  The problem was that it was an enormous number of objects (24 per second), each with thousands of points.  The file would take forever to load and be gigantic!  I never tried that method.

2) Instead of calculating the fluid dynamics on a mesh, use lots of copies of a very small objects in way similar to the way that Terranim8or does particle effects with fire.  That requires an outside program to create an Anim8or file that would be very large with thousands of keyed elements per frame.  I haven't tried that method either.

3) Calculate a single frame at a time on the object and render that in object mode.  I tried to put the render() command into a script, but it crashes Anim8or every time. (I need to report that bug).  That would be a very manually laborious process.

4) Calculate a single frame at a time on the object and render that in scene mode.  Well, that would be as bad as (3) above, but I happened to change into scene mode while a script was running...Behold! the object changed in scene mode as the script continued.  By timing how long Anim8or took to render a frame, and by putting a delay loop in the script so that the next frame is not calculated until the previous frame is rendered, and by post-processing to remove duplicate frames, I was able to produce a fluid simulation that was completely done in Anim8or!

The interesting part is that since this functionality already exists in Anim8or, only a tiny change in the program is required for Steve to make this functionality formal.

I would like to request that an "object script" controller be added with access to the scene variables of time and frame.  If this were done, the full range of physics would be possible in Anim8or!

----

I have attached the ripple script and the project used to generate the above animation.  This test script requires a plane of 100 by 100 points, with the points numbered sequentially.  I will be posting a more complete version that will work with generic meshes soon.  It will be able to do non-planes (spheres, arbitrary solids, even cloth).
Logged

xalener

  • Sr. Member
  • ****
  • Posts: 257
    • View Profile
Re: Simple fluid simulation
« Reply #7 on: June 13, 2009, 09:50:33 pm »

Well... CAN it be controlled with morph targets?
Logged

NickE

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Re: Simple fluid simulation
« Reply #8 on: June 14, 2009, 09:31:06 am »

Theoretically, you could accomplish the same thing as this demo by using a script to precalculate a few dozen morph targets.  You would have to run the script one morph target at a time and end up with a huge an8 file that would take forever to load.
Logged

xalener

  • Sr. Member
  • ****
  • Posts: 257
    • View Profile
Re: Simple fluid simulation
« Reply #9 on: June 14, 2009, 06:59:06 pm »

Huh... Yeah...

I just don't like the way it HAS to be rendered while it's working otherwise you're screwed.
I'd want to scrub through the animation. :/

It's a big leap in the program, though...
Logged

NickE

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Re: Simple fluid simulation
« Reply #10 on: June 14, 2009, 07:53:01 pm »

Yes, it is far from perfect and a bit of a pain to get timed out.  To be broadly useful, object scripts would have to have access to the frame or time variable from scene mode or scene controller scripting would have to be enhanced to support the object scripting abilities to manipulate meshes.

Logged

Maximilianibus

  • Full Member
  • ***
  • Posts: 153
  • Bla Bla Bla, Mr Freeman!
    • View Profile
    • Please Subscribe!
Re: Simple fluid simulation
« Reply #11 on: August 13, 2010, 09:58:46 pm »

how could i create own fluids? i mean, how to number the points? ???
this is one of the BEST scripts in anim8or i've ever seen!
even your hair script is awesome! ;D
Logged

NickE

  • Full Member
  • ***
  • Posts: 168
    • View Profile
Re: Simple fluid simulation
« Reply #12 on: August 14, 2010, 10:16:13 am »

The script and project included above is just a demonstration of the capabilities and to point out the "quirk" of Anim8or of running scripts asynchronously to the rest of the program.

The script above requires a mesh named "s1" of 100 by 100 points.  The points have to be numbered in order of the mesh from 0 to 9999.  The points with Y-coordinates not equal to zero have "excitation", will move up and down, and gradually dampen to zero.  This script only moves the points up-and-down and expects the points to be equal distances away from each other (like a perfect plane)

I've attached a project that has a "blank" water field.  You can try the different kind of rippling, like from the corner, a wave that covers a whole edge, starting the "excitation" above or below the plane, etc.

To render your animation, you have to start the script in object mode, switch quickly to the scene mode and start the render.  The "delay" variable in the script is to allow time for Anim8or to render the frame before the script calculates the next frame.  It takes some experimentation to hone in on a proper delay value for the scene and your computer.  While hunting the proper delay value, set the number of frames variable to just a few frames because you will have to wait for the script to finish to adjust it.

Thank you for your interest.



Logged

cooldude234

  • Sr. Member
  • ****
  • Posts: 902
  • You know what I realized, I dont have an avatar :\
    • View Profile
Re: Simple fluid simulation
« Reply #13 on: August 14, 2010, 10:32:47 pm »

Whoa! I seen that video on anim8or before, but I thought you just used a lot of morphs, seems I was wrong. Now I have to test this script out sometime!

THANK YOU!!
Logged
¼

Bugtrooper

  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: Simple fluid simulation
« Reply #14 on: September 12, 2010, 05:04:45 am »

Awesome!!! Some of you're really upgrading anim8or. I only can spend a little amount of time for anim8or, but I want to upgrade it too. Looks like I have to learn first. :D
And again.......GREAT ANIMATION!
Logged