10-09-2026, 06:33 AM
(This post was last modified: 10-09-2026, 06:37 AM by josemendez.)
(09-09-2026, 03:30 PM)Qriva0 Wrote: Actually I also wanted to give feedback about this.
I wanted to bake, reuse or modify rendered mesh, but it's rendered internally in completely different way and it's hard to access it out of the box.
Can we get improvement here so it's possible to access deformed cloth mesh? Or what is the best strategy to do so?
My use case is to bake distance field from deformed cloth mesh.
Hi!
ObiClothRenderSystem exposes a BakeMesh method that allows you to access the deformed mesh for further processing/rendering:
Code:
BakeMesh(ObiClothRendererBase renderer, ref Mesh mesh, bool transformToActorLocalSpace = false)You pass the cloth renderer, a Mesh that will hold the mesh data extracted from the internal renderer, and an optional flag to transform the mesh to the actor's local space (they're expressed in solver space by default).
This works for both the Burst and the Compute backends. For instance:
Code:
ObiClothRenderer renderer = (ObiClothRenderer)command.context;
if (renderer.actor.isLoaded)
{
var system = renderer.actor.solver.GetRenderSystem<ObiClothRenderer>() as ObiClothRenderSystem;
if (system != null)
{
var mesh = new Mesh();
system.BakeMesh(renderer, ref mesh, true);
// do whatever you want with your mesh
}
}
