Foam tutorial... step by step for someone new to RF4

Discussion about fluid simulation in Realflow 4
FloydBishop
Posts: 44
Joined: Mon Sep 25, 2006 2:05 am
Contact:

Foam tutorial... step by step for someone new to RF4

Postby FloydBishop » Thu Mar 15, 2007 6:26 pm

Hello,

I'm wondering if someone could go through step by step as to how to successfully use a script such as this one: http://www.nextlimit.com/nlscript/scripts/mediumbeerfoam_1939.rfs

I'm new to RF4 (I've been a RF user for quite some time though) and I'm not getting any results even close to what is expected.

Maybe I'm not loading the script correctly? Maybe I don't have my emitters set up correctly prior to running the script?

I've downloaded the trial of RF4, as I've given up trying to get foam to work in RF3.

Any help is greatly appreciated.


User avatar
tsn
Posts: 889
Joined: Fri Oct 27, 2006 10:36 am

Foam tutorial... step by step for someone new to RF4

Postby tsn » Thu Mar 15, 2007 6:33 pm

What´s your problem in detail? Isn´t the script running at all or don´t you only like the results? Don´t you know where to load/use the script or is it about emitter setup? I need a few more information about this.

FloydBishop
Posts: 44
Joined: Mon Sep 25, 2006 2:05 am
Contact:

Foam tutorial... step by step for someone new to RF4

Postby FloydBishop » Thu Mar 15, 2007 8:07 pm

Well, I think the script is running, but I don't see any difference at all in the pre or post simulations. I don't get any results that are different from before I ran the script.

I've found the place to load and use the script, but maybe the problem is in my set-up prior to running the script? I'm sure it's user error here and not anything with RF.

shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Foam tutorial... step by step for someone new to RF4

Postby shaun_michael » Thu Mar 15, 2007 10:18 pm

I think this line:-

Code: Select all

FVelThreshold = 1.0 # Max velocity of foam particles (Raising value = more foam particles staying)

Should read:-

Code: Select all

FVelThreshold = 1.0 # Min velocity of foam particles (Minimum velocity particle should have to stay as foam particle.  Other wise it meets one of the two conditions to turn to fluid inside liquid2)

Put a low value in for LVelThreshold, say 0.3. This is the minimum velocity after collision that dictates whether the liquid particle will turn into a foam particle.

FVelThreshold, set a very low number, say 0.1. This is the velocity a foam particle has to fall below in order to meet one of the two conditions for it to turn back to liquid.

FHeightThreshold (Foam Height Threshold). Simply the Y-axis value for a foam particle over which it will turn back to liquid2 if it also meets the FVelThreshold figure.

Make sure that you change this line of code...

Code: Select all

FHeight = foami.getPosition().getY()

... if your vertical axis isn't the Y-axis. Change the getY to getX, or getZ for instance.

I feel your pain in this. It took me a while to suss it out, but then I'm a scripting dunderhead :)

Assuming you've added the script into the events script window, added the values you want, then ticked the "active" box bottom right of the events script window, the script is good to go. Now all you have to do is set up your scene with the three emitters, I use liquid, liquid2, and foam for my names (original huh?). Set the speed values for liquid2 and foam to zero, place my liqui emitter where I want it, my collision object where I want it and away I go.

Oh, did I also mention that you should set the density value of the foam emitter to be LESS, not more than the liquid/liquid2 emitters?

Seems to work for me, hope that helps you out. To check its working, after your collisions start to happen, and leaving the sim running, select the foam emitter in the nodes tree and you should see little blue particles appearing. Click on the liquid2 emitter and you should see the same, but only when the two values you set as conditions FHeightThreshold and FVelThreshold have been met.

OK, I think this is right, but Thomas will correct me if I'm not :)

Shaun

FloydBishop
Posts: 44
Joined: Mon Sep 25, 2006 2:05 am
Contact:

Foam tutorial... step by step for someone new to RF4

Postby FloydBishop » Thu Mar 15, 2007 10:49 pm

Ahh, I didn't know how to run a script the correct way! OK, I've got some foaming going on. My main emitter stops working for some reason, only spitting out a small amount of fluid before stopping. Any ideas as to why that would be? Something in the script?

Also, there are only two emitters used in this set-up, not three. What are the advantages of a three emitter scene as opposed to two?

shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Foam tutorial... step by step for someone new to RF4

Postby shaun_michael » Fri Mar 16, 2007 5:40 am

Any ideas as to why that would be? Something in the script?

No, there's nothing in the script that governs the number of particles. The only thing I can think of is either you have the number of particles set too low, or you're using the emitter set to volume? You'd really have to show your emitter settings to know that one.

Also, there are only two emitters used in this set-up, not three. What are the advantages of a three emitter scene as opposed to two?

In the script you linked to, there are three emitters required:-

Code: Select all

   # VARIABLES
   liquid = scene.getEmitter("liquid") #set the name of your chosen liquid emitter (liquid type)
   foam = scene.getEmitter("foam") #set the name of your chosen foam emitter (liquid type)
   liquid2 = scene.getEmitter("liquid2") #same parameters as liquid

Liquid - your main emitter
foam - the emitter the liquid particles are taken to to create foam
liquid2 - The emitter the foam particles are returned to when they meet the two criteria.

The idea is that, like in real life the foam turns back to liquid over time.

Shaun

FloydBishop
Posts: 44
Joined: Mon Sep 25, 2006 2:05 am
Contact:

Foam tutorial... step by step for someone new to RF4

Postby FloydBishop » Fri Mar 16, 2007 5:53 am

Ahh, so there are three. What threw me off was in the header of the script

# VARIABLES
liquid = scene.getEmitter("Circle01") #set the name of your chosen liquid emitter (liquid type)
foam = scene.getEmitter("Circle01") #set the name of your chosen foam emitter (liquid type)
liquid2 = scene.getEmitter("Circle02") #same parameters as liquid

If those are the three emitters, shouldn't the "liquid2" emitter be "Circle03" and not "Circle01"? That was part of my confusion.

shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Foam tutorial... step by step for someone new to RF4

Postby shaun_michael » Fri Mar 16, 2007 6:59 am

Strictly speaking, I guess so.

The two circle01 emitter names are just placeholders. You should, as you know, be changing them to be the same name as your liquid and foam emitters, chaning the third to be your liquid2 emitter (making sure it has the same settings as liquid.

Cheers,
Shaun

FloydBishop
Posts: 44
Joined: Mon Sep 25, 2006 2:05 am
Contact:

Foam tutorial... step by step for someone new to RF4

Postby FloydBishop » Fri Mar 16, 2007 7:58 am

So many lightbulbs are turning on today! Thanks for the help. I've got it working now.

bealobo
Posts: 147
Joined: Mon Sep 25, 2006 8:57 am
Contact:

Foam tutorial... step by step for someone new to RF4

Postby bealobo » Fri Mar 16, 2007 8:53 am

;)
Thank you guys, I'm off to correct it to avoid more confussion.
www.bealobo.com


Return to “RF4: Fluid simulation”

Who is online

Users browsing this forum: No registered users and 1 guest