Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  How can I extract the fluid rendering mesh?
#4
(10-07-2024, 04:32 PM)GuoliZheng Wrote: How do I use a script to call the BakeMesh command? I can't access the 7.0 version of the API from the web API button; I can only see version 6.4 and below.
Thank you ! Gran sonrisa

You can call IFluidRenderSystem.BakeMesh. Like so:

Code:
var system = emitter.solver.GetRenderSystem<ObiFluidSurfaceMesher>() as IFluidRenderSystem;

if (system != null)
{
       var mesh = new Mesh();
       system.BakeMesh(yourObiFluidSurfaceMesher, ref mesh);

       // optional, save the mesh as an asset in the project:
       ObiEditorUtils.SaveMesh(mesh, "Save fluid mesh", "fluid mesh");
       GameObject.DestroyImmediate(mesh);
}

Note this is a very expensive operation, specially when using the Compute backend as it must read mesh data back from the GPU and will stall the entire render pipeline. It's not recommended to do this at runtime.

kind regards
Reply


Messages In This Thread
RE: How can I extract the fluid rendering mesh? - by josemendez - 11-07-2024, 10:15 AM