Bake mesh from vertex buffer

Hi,

I am using the “new” Mesh API to load data from mesh with GetVertexBuffer() to Compute Shader and after processing I write back the data into SkinnedMeshRenderer in “OnBeginFrameRendering”.
This works well, but now I’d like to update Mesh Colliders based on the changes I did on the vertex buffer.
How can I transform the buffer back to a mesh, same as SkinnedMeshRender.BakeMesh() would do?

I found a solution which somehow works:

  • do BakeMesh only once to get the initial layout of mesh
  • pull the vertex positions with GetData from ComputeBuffer and update only positions of the mesh.
    Not optimal due to the GetData, but there’s probably no way around this.
1 Like