This is the final network for shot 1 consisting of source Geo, the pebble sim, 2 particle dust sims, and a pyro sim
This is the full network view for shot 2 consisting of the cache of the asphalt sim Felipe made. Then taking that cache and creating an appropriate dirt geometry and force for the sim.
This is the DOP net work for the grains. I am using a “popadvectbyvolume” node to get the forces correct and act like the UFO is lifting it. bothe sop solver and that pop wrangle have the code
if(@P.y < 0.01){
@v.x *= 0;
@v.z *= 0;
}
Which stops the grains under the asphalt from moving.
I then take the result and use “fluid surface” to make the points into geometry.
this is the result of the dirt Geo which acts as the source for the dirt. The grey pieces are under the asphalt pieces that move. I then find the normals that are facing downwards with this code,
if(@N.y < -.999){
setprimgroup(0,"down",@primnum,1,"set");
}
then extrude them downwards. I find the connected pieces and also find the bounding box of all the pieces. I turn both into a volume and I dilate the pieces to make them larger and use the bounding box as a mask so it can only expand on the x and z axis.
This is the force that I am using to advect the grains for the dirt. I make a line and set the top and bottom point to different pscales to make a cone. I then fill it with “points from volume“ node and merge it with the original top point. I sort them by Y position so the top point is always point number 0.
to make the actual forces I use a point wrangle, called “set_distance“ and give each point a distance attribute, which is the distance that each point is away from the original top point.
vector goal = point(0,"P",0);
f@dist = distance(goal,@P);
I then have a detail wrangle that loops through each point and over writes the “lrgDist” variable if it finds a point that has a larger distance than the last one in the loop, if it is smaller an “lrgDist“ stays the same.
float lrgDist = 0.0;
for(int i = 0;i < @numpt; i++){
float pntdist = point(0,"dist",i);
if(pntdist > lrgDist){
lrgDist = pntdist;
}
}
f@maxDist = lrgDist;
lastly to make the actual force attribute I start by making a gradient based on the point’s distance to the top point. The gradient goes from 1 at the bottom to 4 at the top. I make this by fitting the distance which range of numbers goes from 0 to the max distance I found in the last point wrangle, to a new range of 4-1. I then find the vector between the top most point and all the other point by subtracting the position of each point by the goal point’s position and normalizing it. I then multiply the force variable by the accel variable and that creates a force that is directional and has acceleration
vector goal = point(0,"P",0);
float accel = fit(@dist,0,detail(0,"maxDist",0),4,1);
if(@ptnum != 0){
v@force = goal - @P;
}
else{
@force = 0;
}
@force = normalize(@force)*accel;