NVIDIAGameWorks / FleX

Other
664 stars 100 forks source link

Determining fluid depth in an arbitrarily sized hole based on a mesh #3

Closed galapaegos closed 5 years ago

galapaegos commented 7 years ago

Hi,

We are using FleX for fluid simulation in our Temporal Bone simulator for suction/irrigation. We have two collision meshes for the drill and irrigation device, and a SDF for the volumetric dataset. I'm interested in getting a numerical value based on a mesh location to determine how deep the fluid is at that location, basically how much fluid is covering the drill, and how far into the fluid is the suction/irrigation device.

I can determine if the drill is completely submerged using glBeginQuery/glEndQuery, but this will only tell me what percentage of the drill bit is occluded by fluid, and I would like to know how deep is the fluid.

Thanks!

mmacklin commented 7 years ago

I don't think Flex can easily answer a query like "how deep is a point inside the fluid". To get an accurate answer I think you would need to build an SDF from the particles, e.g.: splat them to a grid and then run a general SDF algorithm.

Alternatively, you could try putting a layer of particles around the mesh and then use NvFlexGetDensities() to read the density for those particles. It's not exactly "depth", but might be enough depending on your needs.