Surface tension is zero if the position of particles is zero

   1581   5   2
User Avatar
Member
3 posts
Joined: 4月 2018
Offline
How to use VEX in the Gas field wrangle node to write that the surface tension (FLIP simulation) is zero if the position of the particles in Y is zero?
User Avatar
Member
4851 posts
Joined: 2月 2012
Offline
Hi,

If you bind the first input to Geometry, you can do it like this:



int pts [ ] = pcfind ( 0, "P", @P, 10, 1 );
vector p = point ( 0, "P", pts [ 0 ] );

float tolerance = 0.01;
if ( abs ( @P.y ) < tolerance )
    @surfacepressure = 0;
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
9118 posts
Joined: 7月 2007
Offline
animatrix_
Hi,

If you bind the first input to Geometry, you can do it like this:

int pts [ ] = pcfind ( 0, "P", @P, 10, 1 );
vector p = point ( 0, "P", pts [ 0 ] );

float tolerance = 0.01;
if ( abs ( @P.y ) < tolerance )
    @surfacepressure = 0;

since "surfacepressure" is a float field instead of attribute, only last 3 lines are all it takes
no need to deal with particles at all or bind anything to Geometry a Gas Field Wrangle binds to fields by name automatically
however tolerance should be high enough to include voxel center positions of at least first few voxel layers from the ground to get noticeable effect

or if you want some falloff you can do this
float height_min = 0.1;
float height_falloff = 0.1;

@surfacepressure *= fit(v@P.y - height_min, 0, height_falloff, 0, 1);
Edited by tamte - 2023年7月1日 04:29:09
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
4851 posts
Joined: 2月 2012
Offline
The binding is to check for particle point positions which is what OP was asking.

I know surfacepressure is a field, that's why I am using a Gas Field Wrangle.
Senior FX TD @ Industrial Light & Magic
Get to the NEXT level in Houdini & VEX with Pragmatic VEX! [www.pragmatic-vfx.com] https://lnk.bio/animatrix [lnk.bio]
User Avatar
Member
9118 posts
Joined: 7月 2007
Offline
don't det me wrong, sampling the closest particle attributes to the current voxel may still be handy when basing surfacetension on different particle attributes, or alternatively rasterizing them to field first and sampling that

all I'm saying is that there is no need to care about particle positions in this case, since the surface tension is at voxel level and voxels have roughly the same position as average position of particles within that voxel
so I just assume that OP's description using particles just stems from assuming that it's particle based
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
3 posts
Joined: 4月 2018
Offline
animatrix_, tamte – many thanks for your help!
Edited by aqmdes - 2023年7月3日 14:50:23
  • Quick Links