Jump to content

Particle fluid covering a whole geometry


simoada88

Recommended Posts

Hi guyz!

I'm keeping studying Houdini during this long lockdown and have found my self stuck in a really tricky R&D shot. I know it's a pretty easy thing to solve and I kinda think to know the theory to do it but I just can't solve it!

 

I have created a classic chocolate bar with caramel that get spread on it and now i'm trying to cover it all with a nice chocolate cover.

I've created a geometry for the external cover and a particle fluid emitter for the chocolate that collides with that external cover. I would like the chocolate to run along the geometry and cover it all, without dripping down. I've tried with pop attraction, and pop collision detection on stick... but non of them work properly.

 

I think I should scatter the external geometry and tell the fluid particles to get the position of the scattered particles. In that way they should stick properly.

I tried in adding a sopsolver and linked my sim to my scatter points but at this point we are entering in a foggy place for me.

I don't really get how can I solve this.

What am I missing? (for sure a lot of VEX :) )

 

If anybody wants to help I will really appreciate :)

 

Link to comment
Share on other sites

The PopWrangle does have an Input tab. This means you can reference points from SOPs by specifying a SOP input. This would allow you to create a slider and lerp between your fluid points and scatter points (assuming they have the same count). Animate the bias channel to attract the particles. You may also want to sort your scatter points to align them along one axis.

vector alt_P = point(1,"P", @ptnum);
vector new_P = lerp(@P,alt_P,ch("bias"));
@P = new_P;

 

  • Like 1
Link to comment
Share on other sites

Thanks @Atom! I'm gonna try it immediately! I'm using a basic fluid particle emitter right now for the chocolate stream and the particle count is pretty high. So does the scatter point need to be as high as the part numb of the emitter? I didn't expect that. Thanks for the help. I have never used this method yet. I will try and study it and let you know if I get to a result!

 

Thanks

Link to comment
Share on other sites

Nope @Atom I guess I'm missing something.

I tried what you explained me but I surely missing a point. I also tried your system in a simply set up but no luck with that.

The problem is that when I animate the bias the particles "Stick"(or get attracted) to the origin point and not to the scatter one.

I've also tried this solution starting from a pop system but it doesn't give a nice and natural flow movement like a particle fluid emitter.

And also tried other systems using stick solution on pop collision detection and pop attract (good but not enough)

If you can help me in better understand the logic behind the lerp and the scatter system I will be really great full! From my inexperienced logic of the software seems to be the most logical solution but I can't really understand how it works and how to make it work

I'm attaching a hip to better understand.

Thanks in advance if you can help

s.thumb.PNG.d0d5777fb137c469ad37ed09b0688c6e.PNG

 

Simone

 

caramel.hip

Link to comment
Share on other sites

Well @Masoud it is a good idea!

I have set a age particle system thanks to @ejr32123setup that I found here in odforce.

To make it perfect I should find a way to insert in this system a pop collision detection so that the particles start aging only from the moment of their collision and not before that moment

How can I modify this system to age at collision and not at a certain frame? Is that possible? In this way I can make my fluid more viscous when it has been already poured. What you think?

 

This is the system I'm using:

POP WRANGLE 1 FOR AGE

if (@birth == 0)

{ @birth = @Frame; }

 

@age =@Frame - @birth;

 

POP WRANGLE 2 FOR VISCOSITY

if (@age > 80)

{ f@viscosity = 200; }

 

else f@viscosity = 9000;

 

Link to comment
Share on other sites

Hi there Simone!

Apologies if I explain something you know, it is hard to draw lines on forums :D

Lerp stands for linear interpolate and will blend between two values based on a third value.

result= lerp( value1, value2, howMuchYouBlendBetweenThem 0 to 1)

e.g. in

result= lerp( 3, 6, 0.5)

result will equal 4.5

---

If you lerp between your particles position and your desired end position then it won't look natural as they will just move in a straight line and wont obey the laws of physics

Masouds approach of changing the viscosity based on age seems like a good approach to prevent liquid from dripping off the edge

You can blend this viscocity in a variety of different ways:

- how high the particle

- how far it is from the surface

- age like you're currently doing

There is also a stick on collision setting within the fluid solver which is pretty useful

So there's many ways to go about it

---

I have attached a hip file which uses a geometry wrangle to detect collision with the bar, find the age since collision and increase viscocity based on this age

Here is the code:

int prim;
vector primuv;
xyzdist( 1, v@P, prim, primuv);
vector nrP= primuv( 1, "P", prim, primuv);
float distance= distance( v@P, nrP);
// The above is confusing but is required in order to get the distance to
// the bar geometry
//Make sure input two is set to esternobarretta in the inputs tab of this node


if( distance< 0.6 && i@hit== 0)
{
    f@hitTime= f@age;
    i@hit= 1;
}
//If the distance is less than a certain amount and it hasn't hit before
//then we have just detected out first collision
//so record the time and set hit to 1


f@ageSinceHit= ( f@age- f@hitTime)* i@hit;
//this finds the time since collision


float lerpAmount= fit( f@ageSinceHit, 0, 0.3, 0, 1);
f@viscocity= lerp( 1, 10000, lerpAmount);
//This means that the viscosity will hit 10000 within 0.3 seconds of hitting
//the bar
//In order for the viscocity attribute to work, enable the "Viscosity by Attribute"
//option on the flip solver under "Volume Motion/Viscosity"
v@Cd= lerpAmount;

You said you are new to vex so I hope this isn't overwhelming, it is hopefully useful to study

Kind Regards, Lucy

caramel.hipnc

Edited by ColecloughGeorge
added hip
  • Like 2
Link to comment
Share on other sites

Oh my Gosh! Lucy! that looks increadible!

So in this way you are able to detect when and which particles hits the geometry and from that point you are able to command its viscosity!!! how sweet!

I'm totally new to VEX but I'm studying to get good at it. This is super precious for me thanks! I'll spend the next hour studying on it!

I have tryied in the last hours a different approach based on a scatter and a pop attract set on the scatter particles. Let's see if also that works as a plan B :)

Thank you again!!!! :) <3 

Cheers

 

Simone

  • Like 1
Link to comment
Share on other sites

11 hours ago, simoada88 said:

Oh my Gosh! Lucy! that looks increadible!

So in this way you are able to detect when and which particles hits the geometry and from that point you are able to command its viscosity!!! how sweet!

I'm totally new to VEX but I'm studying to get good at it. This is super precious for me thanks! I'll spend the next hour studying on it!

I have tryied in the last hours a different approach based on a scatter and a pop attract set on the scatter particles. Let's see if also that works as a plan B :)

Thank you again!!!! :) <3 

Cheers

 

Simone

Hi Simone, Cheers

That pop attract sounds like a good approach too, I'm interested in how it turns out! :D

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...