This post describes a simple way to create a system comprising of a regularly surfaced fluid and a faux grain system. The video above contains three clips using the same basic technique: creating a single point source for the FLIP SOP initial data but using groups to render some as a fluid and some as individual tiny spheres - the grains.
The first clip shows a granular sphere dropping into a fluid tank. The initial fluid tank geometry network looks like this:
I added a blast node to the fluid surface node created by the fluid tank shelf tool to remove all the particles from the DRIP group. Then created another node to render the DRIP group particles as faux grains:
Not bad for a first attempt - the granular sphere splashes into the fluid tank and its grains are advected by the fluid.
The second clip flips the effect round: a fluid sphere falls into a torus built from hundreds-and-thousands (or nonpareils for those across the pond). The fundaments are the same, but I use an attribute wrangle in the source geometry node to give the sugary donut a high viscosity to retain its shape.
To get the grains to dissolve (maybe disintegrate is a better word), I diffuse the viscosity. This is done with a POP wrangle node attached to the FLIP solver with the following VEX:
int pointCloud = pcopen(geoself(), 'P', @P, 0.3, 48);
float newViscosity = pcfilter(pointCloud, 'viscosity');
if (newViscosity < @viscosity) {The VEX averages the viscosity of 48 nearby particles and, if less than the current particle's viscosity, updates the current viscosity with that average. Only updating the viscosity with a smaller value ensure the fluid doesn't congeal.
@viscosity = newViscosity;
}
The third and final clip is another experiment dropping a granular body into a liquid. Here, I wanted the granular geometry to not only disintegrate but its component grains to separate. As part of my debugging process, I was updating the point color based on viscosity - since it seemed like a nice effect, I kept that in too.
The final VEX for my POP wrangle is:
if (inpointgroup(geoself(), "PILL", @ptnum)) {
// Diffuse viscosity...
int pointCloud = pcopen(geoself(), 'P', @P, 0.4, 36);
float newViscosity = pcfilter(pointCloud, 'viscosity');
if (newViscosity < @viscosity) {
@viscosity = newViscosity;
}
@Cd = set((@viscosity / 3.0),
1 - (@viscosity / 3.0),
1 - (@viscosity / 3.0));As I'd been tinkering with this technique for a while, I decided to speed things up in the third clip by not rendering the fluid - but actually, I think the final result is quite nice just with the spheres.
// Separate low viscosity particles...
float viscosityLimit = 2.0;
if (@viscosity < viscosityLimit) {
float maxdist = 0.1;
int maxpts = 36;
float seperationStrength = (viscosityLimit - @viscosity) * -50;
int neighbours[] = nearpoints(geoself(), v@P, maxdist, maxpts);
int point;
foreach(point; neighbours) {
if (inpointgroup(geoself(), "PILL", point)) {
@force += (point(geoself(), "P", point) - @P) * seperationStrength;
}
}
}
}
A few caveats: the prevent mysteriously appearing grains, the birth threshold under particle motion / reseeding in my FLIP solver is zero. Also, the POP wrangle nodes attached to the FLIP solver have their first input set to myself.
You have some honest ideas about the Photo editing share here I really get many information and discovered most peoples will agree with your blog.
ReplyDeletePhoto editing