How to update pscale of both cloth and fluid in Vellum

   782   4   2
User Avatar
Member
3 posts
Joined: Oct. 2024
Offline
I am using Vellum Fluid and Cloth to express the interaction between fluids and cloth.

I am performing tasks such as removing particles that collide with the cloth and increasing the mass of the cloth by executing Solver SOP on the two groups, Fluid and Cloth, and processing them separately.
When I connect Sop Solver after Vellum Solver, it works, but the removed particles and cloth mass updates are not reflected in the simulation.
The particles that should disappear remain in the simulation, even though they are not rendered, and since they are located near the cloth, particles farther away from the cloth are not detected as colliding.
I also tried updating these values before the Vellum Solver or using Geometry Wrangle, but the simulation broke down and did not work properly.


I would appreciate any guidance on how to simulate while adjusting the particle @pscale.
User Avatar
Member
19 posts
Joined: Jan. 2019
Offline
Hi
Put the sop solver inside the vellum solver, something like this:

User Avatar
Member
3 posts
Joined: Oct. 2024
Offline
Thank you for your reply!!
Thank you also for taking the time to make a video for me!!

It didn't work because I connected Sop Solver to Force instead of Source.

The error continues to occur, so I will ask the question again.

I updated the @pscale and @mass of the particles that came into contact with the cloth,
and implemented PopKill to delete particles that were completely absorbed by the cloth and had a @pscale = 0.

As shown in the image, the simulation works correctly until a certain frame, but from a certain frame, the particles fly to unexpected positions,
and the simulation suddenly collapses.

The code is written as follows in the Attribute Wrangle within Sop Solver.
If you know the cause, please let me know.

float particleRadius  = detail(0, "ParticleRadius", 0);
float threshold = particleRadius * 4;
float epsilon = 0.0000000001;


if (inpointgroup(0, "fluid", @ptnum))
{
    
    vector Pw = @P;
    int isRemoved = @IsRemoved;
    
    if (isRemoved == 1) {
        i@IsRemoved = 1;
        @mass = epsilon;
        @pscale = epsilon;

    } else {                
        //-------------------------------------------
        float prev_mass = @mass;
        float prev_pscale = @pscale;

        float new_mass = prev_mass;
        float new_pscale = prev_pscale;

        int near_cloths[] = nearpoints(0, "cloth", Pw, threshold);
        
        foreach (int ipt; near_cloths) {
            vector Pi = point(0, "P", ipt);
            
            float max_absorption = 0.00001;       
            float mw = new_mass;
            float m_min = min(max_absorption, mw);
            
            new_mass -= m_min;
        }
        
        if (new_mass < 0.0) {
            i@IsRemoved = 1;
            @mass = epsilon;
            @pscale = epsilon;
        } else {        
            @mass = new_mass;
            new_pscale = pow((new_mass / (prev_mass + epsilon)), (1.0 / 3.0) ) * prev_pscale;            
            if (new_pscale < 0.0) {
                i@IsRemoved = 1;
                @mass = epsilon;
                @pscale = epsilon;

            } else {
                @pscale = new_pscale;
            }   
        }    
    }  
}


・I also tried setting epsilon=0, but it did not work.
・The threshold value is large enough.
・The "cloth" group has been changed from primitive to point for implementation purposes.

Attachments:
Frame13.jpg (586.7 KB)
Frame14.jpg (462.2 KB)

User Avatar
Member
19 posts
Joined: Jan. 2019
Offline
if I connect the sop solver to force instead of source, the result is the same for me, there is no difference
User Avatar
Member
3 posts
Joined: Oct. 2024
Offline
So, what is the difference between Force and Source?
Also, no matter which one I connect, the simulation explodes as shown in the image.
  • Quick Links