B2B what does the vealue mean?

Hey everybody,

As many others I’m wrorking on a beer sim but i sturggle a little bit with the foam head.
I was playing around with the B2B interaction value to get the proper result but can someone tell me what this value actually mean?
Is it the total number of bubbles that will collide with each other?

no, this is how strong the bubbles are attracted/repulsed to each other. (b2b means bubble to bubble)
many forces are affecting the bubbles, beside b2b force the important ones are the inertia, the external fluid movement, and the gravity. all the forces are added and if the b2b value is big enough, the b2b force will dominate over the other forces and can keep the bubbles arranged properly even when the other forces are trying to separate/smash the foam.
in your case if the b2b parameter is not big enough, the foam will be smashed by the gravity.
the bubble size is very important for the good locking foam! how it affects the appearance - it’s very simple, when the bubbles are small, you need bigger count to fill certain volume with foam. this may be very misleading, because increasing the bubble size with only 25% will double the volume of the foam! how this happens? this is because the volume grows with power of 3 of the linear size. a bottle that is just twice larger can keep eight times more liquid! keep in mind this when you adjust the bubble size.
and one important note to the b2b parameter. if we just use the b2b parameter as a multiplier to the b2b force, we will get instability, the foam will just blow. so we need to apply some complicated math to avoid this instability and increasing the b2b parameter you will get slower simulation.
how to adjust the beer head?
i would recommend first to make experiments with pure foam, made by a non interacting source (similar to the brush mode fill up)
with such a source you can see the foam behavior in few frames, without waiting the entire beer fill up. when you are satisfied by the foam, you will have to perform twice the full simulation
the first one is with small birth rate of the foam, just to measure the foam birth
the second one is with foam birth increased by the ratio: “needed foam”/“the foam in the first sim”

awesome! Thank you for the very detailed explanation and also for the tips to test the foam behavior, I’ll try it out.

Oh, i got another one. I also have the problem that 1/4 of my foam head is under water. Now i could adjust the water level with the surface Level parameter in the rendering rollout to get the surface beneath the foam but i don’t want to change the look of my fluid. Is there anything else i could do?

can you share the liquid settings? just make a screenshot of all the rolluots opened

Sure here they are:

I also send you the max file to your email, phoenix@chaosgroup.com

honestly have no idea. the strength of the underwater foam is about 100 times bigger than the strength of the above water foam, and this leads to almost all the foam rises above the water. can you share a picture of the final settled state?
edit: the rising and falling limits may affect the above/under water ration, but yours limits seem to be pretty normal.

There,

It looks almost perfect, exept for the foam head.

the only think that differs to original beer sample is the lack of large bubbles. i wonder is it possible to be this? there is no reason the large bubbles to play important role in the head forming, but who knows.

Well, i will certainly try it out but… i don’t want large bubbles :frowning:

One question, you said previosly " the strength of the underwater foam is about 100 times bigger than the strength of the above water foam" at what parameter can you see this?

this is not a parameter, it is internally hardcoded and in normal cases the under/above water ratio is 1/100. in your case it’s much bigger, that i can’t explain.

would it be possible than to expose this ratio as a parameter to be able to controll the level of the foam?

well, apparently there the problem is that this parameter does not work. i really doubt that if you increase it, the problem will disappear. i will investigate the scene tomorrow, hopefully some workaround exists

i found it, you are using resimulation, in the last official build the resimulation has a bug that pushes the foam toward the bottom. now i’m waiting the simulating to be sure that this is the reason, will post the result later

awesome, thanks!

perhaps is not this, now the simulation is finished and it still has underwater foam
but unlike your image, here the foam overflows the glass. not sure is it possible to be this, too much foam above the water perhaps.

well, the foam was supposed to fill the collision object up to the top but not to slope out of it.

But there is still one thing about the foam I’d like to understand. How does the foam relate to the surface level parameter in the rendering rollout? Most of the time i try to leave this parameter at 0,5 but sometimes the fluid looks better with lower values. Does the foam react to this parameter in some way?

the surface level parameter affects only the rendering of the liquid, it’s not related to the foam directly.
the foam may be affected if it forms a thin layer, in this case the surface level can change put the foam below or above the water and thus to change it’s appearance