Obi Official Forum

Full Version: softbody cut
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
First of all, thanks to OBI, this is the best pbd physics engine I've ever used.

I have a few questions about softbody cut:
1. Is there a plan to support cutting and tearing?
2. I implemented the method described in this post.
http://obi.virtualmethodstudio.com/forum...-3561.html
This should be the easiest way. However, there are too many problems, such as the performance, recalculation of the attachment and stitcher brought by the new softbody objects, and the continuation of collision posture, which are all troublesome

3. Can i reframe the softbody by redividing the particle and Constraints just as you did with rope cutting?

4. I do not understand the relationship between softbody Constraint, ConstraintBatch and Particle. Could you explain it?
http://obi.virtualmethodstudio.com/manua...aints.html
Only rope and cloth are available here


Thanks a lot in advance Gran sonrisa
(15-12-2022, 05:16 AM)Seahorse Wrote: [ -> ]1. Is there a plan to support cutting and tearing?

Not right now, since particle-based approaches do not lend themselves well to mesh cutting. Tetrahedron-based approaches are much better suited for this.

(15-12-2022, 05:16 AM)Seahorse Wrote: [ -> ]3. Can i reframe the softbody by redividing the particle and Constraints just as you did with rope cutting?

Rope tearing is considerably easier since the constraints structure is very simple: only 2 batches (odd and even constraints) and no need for remeshing or updating the topology of the mesh

Cloth tearing is a bit more complex, but still fairly easy since there's a 1-1 correspondence between particles and vertices, so updating the topology of the mesh is trivial.

Note neither can be considered "cutting", since tearing always happens across existing topology edges: no new faces are generated.

(15-12-2022, 05:16 AM)Seahorse Wrote: [ -> ]4. I do not understand the relationship between softbody Constraint, ConstraintBatch and Particle. Could you explain it?
http://obi.virtualmethodstudio.com/manua...aints.html
Only rope and cloth are available here

Softbodies are 100% identical to ropes and cloth in this regard, the only difference being that the number of particles referenced by each constraint type is different. Otherwise everything works exactly as described in the link: each individual constraint references a variable amount of particles, constraints are grouped into batches so that constraints in the same batch cannot share any particle with each other.

Softbodies use shape matching constraints. For details regarding the data stored in each shape matching batch, look for "ObiShapeMatchingConstraintsBatch" in the Api docs: http://obi.virtualmethodstudio.com/api.html

let me know if you need further help with this,

kind regards
Thank you for your answer and help.

it be easier to implement a Volume sampling based softbody? 
I see that nvidia flex can do something similar.
ElementMo/FlexCutting: Work in progress object cutting based on Nvidia Flex (github.com)

Currently, it takes much longer to regenerate blueprint than to cut mesh.

That's how long it takes me to cut a ball in half:
CutByData:0.01230454
left:
GenerateImmediate:1.163653
BindSkin:0.2261705
right:
GenerateImmediate:1.111993
BindSkin:0.1917148
(15-12-2022, 01:50 PM)Seahorse Wrote: [ -> ]it be easier to implement a Volume sampling based softbody? 
[color=#101214][size=small][size=small]I see that nvidia flex can do something similar.

Set volume sampling to "voxels" in the blueprint editor, it uses the exact same method that Flex does. See:
http://obi.virtualmethodstudio.com/manua...setup.html

However this doesn't make runtime tearing any easier, the only difference with other sampling methods is particle placement (regular grid inside the volume vs distributed on the surface of the mesh).

(15-12-2022, 01:50 PM)Seahorse Wrote: [ -> ]Currently, it takes much longer to regenerate blueprint than to cut mesh

That's to be expected, since resampling/ re-voxelizing the mesh, constraint generation and graph coloring to partition constraints into batches are extremely expensive. Obi 6.5 greatly improved blueprint generation performance compared to 6.4, however it's still far from adequate for realtime use.

May not be necessary to regenerate the entire blueprint or bind the entire skin, but only the areas that have been affected by the cut. The github project you shared seems to simply break constraint connections between particles, which is fairly simple to do. Doesn't require to regenerate the blueprint at all, since the amount and placement of particles is the same before and after the cut there's no need to resample the mesh, and no new constraints are generated so you don't need to reorganize batches either. However it completely ignores the complex/difficult part: remeshing (updating mesh topology to match the updated particle representation, and re-binding it to the particles).
I see. Thanks for the clarification.

If I simply unbind the volume softbody, I just need to re-bindskin it?

Is this a viable path?
(15-12-2022, 03:13 PM)Seahorse Wrote: [ -> ]I see. Thanks for the clarification.

If I simply unbind the volume softbody, I just need to re-bindskin it?

Is this a viable path?

Rebinding the entire skin is rather expensive, and it assumes that you have already regenerated the mesh topology in a way that's suitable for softbody simulation. If you already have a viable way of cutting the mesh and you don't mind it taking half a second or so (or even more for larger meshes), then it's ok.

Also note that typical hole filling algorithms (eg. ear clipping) used in mesh cutting do not generate new vertices for the mesh, they just tend new faces across the gap. This is fine for rigidbody simulation but will not be enough for proper softbody simulation unless the softbody is extremely rigid, since these faces will not be able to deform properly. You'd generally want to resample the hole first by distributing vertices across its surface, and then triangulate.
OK, you are very detailed. I understand a lot of things.
I have a mature method of mesh cutting and triangulation. I'm going to make some attempts at today's discussion, and I'll share my progress.

thank you
(15-12-2022, 03:28 PM)Seahorse Wrote: [ -> ]OK, you are very detailed. I understand a lot of things.
I have a mature method of mesh cutting and triangulation. I'm going to make some attempts at today's discussion, and I'll share my progress.

thank you

You're welcome, let me know if I can be of further help.
There was 2 problem:
1.How do you get a constraint between two particles?
Are P1 and P2 just two particles of the same constraint?

Code:
        var dc = softbody.GetConstraintsByType(Oni.ConstraintType.ShapeMatching) as ObiConstraints<ObiShapeMatchingConstraintsBatch>;
        var sc = softbody.solver.GetConstraintsByType(Oni.ConstraintType.ShapeMatching) as ObiConstraints<ObiShapeMatchingConstraintsBatch>;
        sc.RemoveFromSolver();
        for (int j = 0; j < dc.batches.Count; ++j)
        {
            var batch = dc.batches[j];
            Debug.Log("The number of particles in each bound batch:" + j + "/" + batch.numIndices.count);
            var solverBatch = sc.batches[j];
            int offset = softbody.solverBatchOffsets[(int)Oni.ConstraintType.ShapeMatching][j];
            for (int i = 0; i < batch.activeConstraintCount; i++)
            {
               
                int index = i + offset;
                int p1 = batch.particleIndices[i * 2];
                int p2 = batch.particleIndices[i * 2 + 1];

                int or1 = softbody.solverIndices[p1];
                int or2 = softbody.solverIndices[p2];
                //Get particle position
                Vector3 pos1 = softbody.solver.positions[or1];
                Vector3 pos2 = softbody.solver.positions[or2];
                ....
            }
        }

        sc.AddToSolver(softbody.solver);

2.solverBatch.RemoveParticleFromConstraint
What does it do?
(19-12-2022, 12:19 PM)Seahorse Wrote: [ -> ]There was 2 problem:
1.How do you get a constraint between two particles?

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.

(19-12-2022, 12:19 PM)Seahorse Wrote: [ -> ]Are P1 and P2 just two particles of the same constraint?

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:

Quote:firstIndex:  first particle in each constraint.
numIndex: amount of particles in each constraint.

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.

(19-12-2022, 12:19 PM)Seahorse Wrote: [ -> ]2.solverBatch.RemoveParticleFromConstraint
What does it do?

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