25-08-2020, 08:00 AM
(This post was last modified: 25-08-2020, 08:00 AM by josemendez.)
(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.