Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
softbody cut
#11
(19-12-2022, 12:30 PM)josemendez Wrote: You don't.

Or more, precisely: you iterate trough all constraints in all batches until you find the one that references the two particles you're looking for. This is of course extremely slow, but neither simulation or tearing need to know which constraints affect a specific particle: you only need to know which particles are involved in each constraint. At no point you need to map particles-->constraint, it's always constraint-->particles.

You shouldn't need to do this for softbody cutting. What you do is you iterate trough all constraints just once per frame, and for each constraint you determine whether it's involved in a cut or not, then update it accordingly.


You're mixing up distance and shape matching constraints here, shape matching constraints generally have more than 2 particles per constraint. You're supposed to use the firstIndex and numIndex arrays to retrieve the list of particles in each constraint. See the API documentation for shape matching batches:


So to the indices of the particles in constraint #5 are found in the <firstIndex[5], firstIndex[5]+numIndex[5]> range of entries in batch.particleIndices. If you've used Flex's API before, this works the exact same way.


It's pretty self-explanatory: it removes a particle from the constraint, so it's no longer affected by it.

A demo of this at some point would be top notch. Anyway, to understand the breakdown here:

- Detect the particles affected by the cut
- Search for the constraints that include those particles
- Break the found constraints.

How about the remeshing/unbinding + rebinding part?
Reply
#12
(20-07-2023, 12:14 PM)manurocker95 Wrote: How about the remeshing/unbinding + rebinding part?

Hi,

Remeshing is the difficult & expensive part of the problem, and mainly the reason why softbody cutting is not built-in into Obi. There's many ways to tackle it, some I can think of:

- Start off by tetrahedralizing the base mesh. Whenever a shape matching constraint breaks/tears, find the closest tetrahedra and split it along its faces. This is analogous to cloth tearing, only in 3D. Keeps the shape of the mesh's surface intact and is probably the cheapest solution -even if still expensive- but its only as good as your tetrahedral mesh is.

- Rebuild the mesh every frame using isosurface extraction from particles, something like surface nets or marching cubes. Expensive and only respects the shape of the input mesh as much as its particle representation does.

- Use a directed hole-filling algorithm to bridge cuts in the mesh.

kind regards,
Reply