Posts: 39
Threads: 11
Joined: Feb 2019
Reputation:
1
06-02-2019, 04:46 PM
I am attempting to use the obi softbody for vehicle deformation but it extremely challenging.
The problem I am having is the vehicle just collapses (I increased the polycount and frame rate drop dramatically)
I've tried increasing the solver substeps, and the amount of shape matching constraints. Frame rate dropped to 8fps.
Is there a setting similar Obi Rods to keep the rest shape of a softbody and still to allow it to deform?
Any advice or help is appreciated.
Thanks
Posts: 6,266
Threads: 24
Joined: Jun 2017
Reputation:
397
Obi Owner:
06-02-2019, 06:48 PM
(This post was last modified: 06-02-2019, 06:50 PM by josemendez.)
(06-02-2019, 04:46 PM)StudioTatsu Wrote: I am attempting to use the obi softbody for vehicle deformation but it extremely challenging.
The problem I am having is the vehicle just collapses (I increased the polycount and frame rate drop dramatically)
I've tried increasing the solver substeps, and the amount of shape matching constraints. Frame rate dropped to 8fps.
Is there a setting similar Obi Rods to keep the rest shape of a softbody and still to allow it to deform?
Any advice or help is appreciated.
Thanks
Hi there,
Rods and soft bodies use the same core concept at the core. A softbody will try to maintain its rest shape, given appropriate settings (short enough tilmestep, sufficient iterations, and not too many clusters).
You should have less/larger particles (increase the particle radius) and larger shape matching clusters (increases soft cluster radius). This way you'll get more rigid clusters -since they involve more particles- and cheaper simulation too since there's less of them. There's no need to have one particle per vertex in the mesh, that will kill performance for larger models.
Quote:I increased the polycount and frame rate drop dramatically
The main advantage of Obi is that it lets you define a coarser, particle-based representation that has much less particles than vertices in the original mesh. So take advantage of it!
In the near future we want to allow for manual editing of individual shape matching clusters in-editor, which would give a bit more control over soft body creation.
Posts: 39
Threads: 11
Joined: Feb 2019
Reputation:
1
06-02-2019, 08:56 PM
(This post was last modified: 06-02-2019, 08:58 PM by StudioTatsu.)
Awesome that fixed it.
I think there a bug. At first, I thought it was model but it did the same thing on the DeformableBarrels scene.
It prematurely deforms if rotated before the scene starts.
To Repro:
1. Open the DeformableBarrels scene.
2. change any barrel Y position to 0.1
3. change that same barrel X Rotation to 90
4. click pause, then play button.
Notice how it deforms as the scene starts
It's not as noticeable here, definitely more noticeable with a different model (see attached image)
Not sure if it's a wrong setting or a bug.
Okay now that I reported that, here are my follow on questions:
1. Can I set the mass or weight of a softbody? How if possible.
2. Can a softbody be completely driven by a rigidbody? Alternatively, can I manipulate a softbody like a rigidbody (add forces, impulses, etc.,)?
3. Is there a way to return deformation value of a softbody? How bad is it damaged?
Thanks,
BTW This plugin has already surpassed my expectations, I love it.
Posts: 6,266
Threads: 24
Joined: Jun 2017
Reputation:
397
Obi Owner:
(06-02-2019, 08:56 PM)StudioTatsu Wrote: Awesome that fixed it.
I think there a bug. At first, I thought it was model but it did the same thing on the DeformableBarrels scene.
It prematurely deforms if rotated before the scene starts.
To Repro:
1. Open the DeformableBarrels scene.
2. change any barrel Y position to 0.1
3. change that same barrel X Rotation to 90
4. click pause, then play button.
Notice how it deforms as the scene starts
It's not as noticeable here, definitely more noticeable with a different model (see attached image)
Not sure if it's a wrong setting or a bug.
Okay now that I reported that, here are my follow on questions:
1. Can I set the mass or weight of a softbody? How if possible.
2. Can a softbody be completely driven by a rigidbody? Alternatively, can I manipulate a softbody like a rigidbody (add forces, impulses, etc.,)?
3. Is there a way to return deformation value of a softbody? How bad is it damaged?
Thanks,
BTW This plugin has already surpassed my expectations, I love it.
Hi! Will try to reproduce the issue and get back to you asap.
Regarding your questions:
1.- Yes, in fact you can set the mass on a per-particle basis. Enter particle edit mode, select the particles you want to edit, and set their mass in the mass input field. See:
http://obi.virtualmethodstudio.com/tutor...iting.html
2.- Yes and yes. Use pin constraints to attach particles to a collider/rigidbody combo. This establishes a two-way relationship between the particles and the rigid body. See:
http://obi.virtualmethodstudio.com/tutor...aints.html
http://obi.virtualmethodstudio.com/tutor...ments.html
To add forces or impulses, use softbody.AddForce() or softbody.AddTorque(). They behave in exactly the same way as their Rigidbody counterparts. Note that softbody.AddForce applies the force/torque at the soft body's center of mass. If you want to apply an off-center force, then set solver.externalForces[solverParticleIndex]. This lets you add forces on a per-particle basis. See:
http://obi.virtualmethodstudio.com/tutor...icles.html
3.- Not currently, though we do calculate this internally. For each cluster, we have a 3x3 deformation matrix. Calculating the frobenius norm of the difference between this matrix and the identity matrix (undeformed state) we determine how deformed the cluster is. In the future we will expose either the norms (scalar values, 0 is undeformed and high values mean higher deformation), the deformation matrices, or both (yet to decide).
Posts: 6,266
Threads: 24
Joined: Jun 2017
Reputation:
397
Obi Owner:
(06-02-2019, 08:56 PM)StudioTatsu Wrote: Awesome that fixed it.
I think there a bug. At first, I thought it was model but it did the same thing on the DeformableBarrels scene.
It prematurely deforms if rotated before the scene starts.
To Repro:
1. Open the DeformableBarrels scene.
2. change any barrel Y position to 0.1
3. change that same barrel X Rotation to 90
4. click pause, then play button.
Notice how it deforms as the scene starts
It's not as noticeable here, definitely more noticeable with a different model (see attached image)
Not sure if it's a wrong setting or a bug.
I think I found a bug that caused this, and fixed it.
Replace lines 429-433 of ObiActor.cs with this:
Code: if ((data & ParticleData.REST_POSITIONS) != 0 && restPositions != null && i < restPositions.Length){
Vector4 rest = l2sTransform.MultiplyPoint3x4(restPositions[i]);
rest.w = restPositions[i].w;
solver.restPositions[k] = rest;
}
if ((data & ParticleData.REST_ORIENTATIONS) != 0 && restOrientations != null && i < restOrientations.Length)
solver.restOrientations[k] = l2sRotation * restOrientations[i];
Thanks for reporting this! let me know how it goes.
Posts: 39
Threads: 11
Joined: Feb 2019
Reputation:
1
Thanks for your help and the bug fix solution.
Since there isn't a way to return how deformed a softbody is, Are there any exposed methods/properties or ways of returning the strength of an impact?
Let me explain what I am trying to achieve...
My Car frame is using a softbody:
Case 1: The strength of the impact would determine which crash audio to use.
Case 2: Runs into a tree, depending on how damaged the body is, the car will no longer move.
Case 3: The User Finishes the level, Repairs are needed on the car. The Softbody Damage amount will determine the cost of repairs.
If there is another solution to solving these cases, please advise.
I will try other approaches - I just don't want to reinvent the wheel if properties or methods already exist in the Obi framework.
Thanks again for your help
Posts: 39
Threads: 11
Joined: Feb 2019
Reputation:
1
08-02-2019, 01:59 AM
(This post was last modified: 08-02-2019, 02:10 AM by StudioTatsu.)
The bugfix worked... kinda.
The mesh no longer deforms at the start but is caused 2 new issues:
1. The Skin Mesh Render Bounds Center is Offset
2. The Softbody Gameobject vanishes when you zoom in closer to it. (Not because of clipping planes)
To Repro:
Open DeformableBarrels scene.
Look in the scene window after you press play you will see the skinning mesh render box offset
Zoom in closer to the gameobject it will vanish (it does not do this with the original code)
Posts: 6,266
Threads: 24
Joined: Jun 2017
Reputation:
397
Obi Owner:
(08-02-2019, 01:59 AM)StudioTatsu Wrote: The bugfix worked... kinda.
The mesh no longer deforms at the start but is caused 2 new issues:
1. The Skin Mesh Render Bounds Center is Offset
2. The Softbody Gameobject vanishes when you zoom in closer to it. (Not because of clipping planes)
To Repro:
Open DeformableBarrels scene.
Look in the scene window after you press play you will see the skinning mesh render box offset
Zoom in closer to the gameobject it will vanish (it does not do this with the original code)
Hi,
My apologies, didn't have the bounds into account for the fix. Leave the lines in ObiActor.cs as they were:
Code: if ((data & ParticleData.REST_POSITIONS) != 0 && restPositions != null && i < restPositions.Length)
solver.restPositions[k] = restPositions[i];
if ((data & ParticleData.REST_ORIENTATIONS) != 0 && restOrientations != null && i < restOrientations.Length)
solver.restOrientations[k] = restOrientations[i];
And replace line 117 in ObiShapeMatchingConstraintsBatch.cs with this:
Code: orientations = new AlignedQuaternionArray(ConstraintCount,constraints.Actor.ActorLocalToSolverMatrix.rotation);
This is much cleaner and considers the skinned mesh renderer bounds.
Posts: 39
Threads: 11
Joined: Feb 2019
Reputation:
1
08-02-2019, 01:21 PM
Thanks! That fixed it.
|