Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting fluid into ice mesh
#1
Hi. After my fluid simulation has settled, I want to freeze it. The scene will potentially contain a lot of ice at any given time, but a limited amount of flowing liquid, so for efficiency I'm guessing the best thing to do is to create a mesh from the fluid surface at the moment it freezes.

So my idea is to grab all the particle positions, write them to a grid and run a Marching Cubes algorithm; does that seem feasible? Am I reinventing the wheel in making a feature Obi already has? And is there anything I need to know about how to interpret the Obi parameters, in order to for the ice mesh to look as similar as possible to the original fluid? (e.g. I'm unsure how to simulate Thickness Cutoff...)
Reply
#2
(24-08-2020, 07:36 PM)LaurieCheers Wrote: Hi. After my fluid simulation has settled, I want to freeze it. The scene will potentially contain a lot of ice at any given time, but a limited amount of flowing liquid, so for efficiency I'm guessing the best thing to do is to create a mesh from the fluid surface at the moment it freezes.

So my idea is to grab all the particle positions, write them to a grid and run a Marching Cubes algorithm; does that seem feasible? Am I reinventing the wheel in making a feature Obi already has? And is there anything I need to know about how to interpret the Obi parameters, in order to for the ice mesh to look as similar as possible to the original fluid? (e.g. I'm unsure how to simulate Thickness Cutoff...)

Hi there!

Obi does not provide a way to freeze fluid, but your idea is not far from what you'd need to do.

You could generate a mesh from the particles (using marching cubes, surface nets, or any other similar isosurface extraction method), get rid of the particles entirely, and use the resulting mesh to generate a MeshCollider, add a rigidbody and you'd be done. Obi does include a voxelizer that, while intended for mesh voxelization, you could use as a starting point to voxelize particles. From there to surface nets is just a few steps. You can find it at Obi/Scripts/Common/DataStructures/Voxelization/MeshVoxelizer.cs

Some of the fluid renderer parameters are quite specific to screen space ellipsoid splatting, which is the technique used to render fluid. Thickness Cutoff could be considered a isosurface offset value. Other parameters (Smoothness) are not quite that straightforward to reinterpret.
Reply
#3
(25-08-2020, 08:00 AM)josemendez Wrote: Hi there!

Obi does not provide a way to freeze fluid, but your idea is not far from what you'd need to do.

You could generate a mesh from the particles (using marching cubes, surface nets, or any other similar isosurface extraction method), get rid of the particles entirely, and use the resulting mesh to generate a MeshCollider, add a rigidbody and you'd be done. Obi does include a voxelizer that, while intended for mesh voxelization, you could use as a starting point to voxelize particles. From there to surface nets is just a few steps. You can find it at Obi/Scripts/Common/DataStructures/Voxelization/MeshVoxelizer.cs

Some of the fluid renderer parameters are quite specific to screen space ellipsoid splatting, which is the technique used to render fluid. Thickness Cutoff could be considered a isosurface offset value. Other parameters (Smoothness) are not quite that straightforward to reinterpret.


Can I find some help anywhere with some details on the process towards doing this? 

It seems quite advanced and I would like to know if there is any info you have that might help me get going. 


Thank you!
Reply
#4
(09-02-2022, 03:04 PM)john-alienx Wrote: Can I find some help anywhere with some details on the process towards doing this? 

It seems quite advanced and I would like to know if there is any info you have that might help me get going. 


Thank you!

It's quite advanced if you haven't dealt with meshing algorithms before, but don't be intimidated. Look for surface nets online, there's lots of resources:

https://cerbion.net/blog/understanding-surface-nets/
https://github.com/Q-Minh/naive-surface-nets
https://www.youtube.com/watch?v=fnw9aiKN0iQ

The basic idea is to start from a voxel representation of the fluid, build a "blocky" mesh from that, and smooth it out.
Reply