Obi Official Forum
Softbody with SkinnedMesh - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html)
+--- Thread: Softbody with SkinnedMesh (/thread-2533.html)



Softbody with SkinnedMesh - Yotingo - 13-10-2020

Hi, 

Our team is considering an Obi Softbody purchase but we want to ensure it will suit our needs.

What are the limitations with using Obi Softbody on an animated SkinnedMesh?
We're basically trying to deform a character's skin when it gets hit.

In your video, I see that you do have an a skinnedMesh with dangly arms. 
Does Obi Soft replace the Mesh in those areas? Or are you simply using particles to create the skinnedMesh?

If you have a demo package, we would love to try it out.

Any info will be great!

- Thanks


RE: Softbody with SkinnedMesh - josemendez - 14-10-2020

Hi there!

The main limitation is that a vertex must either be simulated, or animated, you can't mix/blend between the two. See:
http://obi.virtualmethodstudio.com/tutorials/charactersoftbody.html

Softbody simulation works by generating a particle-based sampling of the character mesh, then skinning the mesh to these particles.

Particles of a user-defined size will be placed at the surface of the mesh, keeping a user-defined spacing in between them. These are used to perform the simulation. Then, they are added to the SkinnedMeshRenderer as additional bones, and vertices are skinned to the nearest (within a radius) particle in the softbody. In the dangly arms character scene, the arms are 100% simulated, while the rest of the body is 100& animated.

There's no demos available unfortunately, as there's no easy restriction/limitation to be placed on the package that still lets you evaluate it properly. We have no problem accepting refunds for any reason, though. Do be warned that the store is taking quite a lot of time to attend refund requests lately (> 20 days), as they seem to be overwhelmed with requests. Indeciso


RE: Softbody with SkinnedMesh - Yotingo - 14-10-2020

Thanks for the info!
I have a few more questions, just to be sure I understand everything:

Quote: a vertex must either be simulated, or animated, you can't mix/blend between the two

Are there any limitations with animated bones further down the hierarchy, below a simulation? 
Example: Arms are simulated (no animations) and attached hands are animated (no simulation).

Quote:Particles of a user-defined size will be placed at the surface of the mesh, keeping a user-defined spacing in between them. These are used to perform the simulation. Then, they are added to the SkinnedMeshRenderer as additional bones

Does this mean you end up with thousands of bones? 
How do you control the number of bones created?
Are the bones regenerated each frame?
I don't understand how the bones deform their shape to match the simulation, unless they are re-created each frame.


RE: Softbody with SkinnedMesh - josemendez - 14-10-2020

(14-10-2020, 08:40 AM)Yotingo Wrote: Are there any limitations with animated bones further down the hierarchy, below a simulation? 
Example: Arms are simulated (no animations) and attached hands are animated (no simulation).

No issues, as long as key elements in the hierarchy (mainly joints) are animated. Say you simulate the entire arm, from wrist to shoulder: You'd then have a "spaghetti" arm that follows wrist and shoulder, but the elbow would not follow the animation and instead wobble around.

(14-10-2020, 08:40 AM)Yotingo Wrote: Does this mean you end up with thousands of bones? 
How do you control the number of bones created?

When you set particle sizing and spacing, this automatically determines the amount of bones, as there's one bone per particle. Large particles = fewer bones. Smaller particles = more bones, up to one per vertex. See: http://obi.virtualmethodstudio.com/tutorials/softbodysetup.html

Linear blend skinning is extremely cheap (one matrix multiplication per vertex), so having many bones is not an issue at all.

Quote:Are the bones regenerated each frame?
I don't understand how the bones deform their shape to match the simulation, unless they are re-created each frame.

No, bones are generated once and the mesh skinned to them, at edit time. This is an expensive operation so we avoid doing it at runtime. At runtime there's a simple loop that does this:

for all bones{
bones[i].position = particles[i].position;
}

This makes sure bones follow the simulation. Compared to what the simulation does, updating bone positions is basically free in terms of performance.


RE: Softbody with SkinnedMesh - Yotingo - 19-10-2020

It all sounds great! 

How does Obi Softbody handle collisions when applied to a SkinnedMesh?

I saw the 'Collisions' page in the manual but it doesn't mention SkinnedMeshes or Realtime updating/deformation.
It sounds like it uses particles like Obi Cloth for collisions, but how does that work in scope of the rest of the character? 
Is the entire MeshCollider updated to match the SkinnedMesh, even when the deformation is caused be animation?


RE: Softbody with SkinnedMesh - josemendez - 19-10-2020

Hi,

realtime updating/deformation works for collisions the same way it works for softbody dynamics: per-particle collisions, contacts move particles around, and as a result the mesh is deformed (since each particle acts as a bone). No special handling is required for this, it just works. Collisions are simply constraints that affect particles.

Quote:Is the entire MeshCollider updated to match the SkinnedMesh, even when the deformation is caused be animation?

no MeshColliders are involved in character collisions, just particles. Obi is a particle-based physics engine, so everything uses particles for collision detection. Using MeshColliders for this would be extremely slow.


RE: Softbody with SkinnedMesh - Yotingo - 20-10-2020

I appreciate your time!
I think this is the last set of questions I have for now:

Quote:realtime updating/deformation works for collisions the same way it works for softbody dynamics: per-particle collisions, contacts move particles around, and as a result the mesh is deformed (since each particle acts as a bone). No special handling is required for this, it just works. Collisions are simply constraints that affect particles.


If I understand this correctly; Obi Softbody (particle physics) can be affected by other colliders but not the other way around? (The particles won't move other colliders)


Quote:When you set particle sizing and spacing, this automatically determines the amount of bones, as there's one bone per particle. Large particles = fewer bones. Smaller particles = more bones, up to one per vertex. 


With each particle being assigned it's own bone; are these bones created at runtime or in editor? 
Are the original bone SkinnedMesh assignments overwritten? (Meaning any part of the mesh affected by Obi Softbody is no longer affected by the original bones)


RE: Softbody with SkinnedMesh - josemendez - 20-10-2020

(20-10-2020, 11:35 AM)Yotingo Wrote: If I understand this correctly; Obi Softbody (particle physics) can be affected by other colliders but not the other way around? (The particles won't move other colliders)

Colliders by themselves can't move or respond to physics in any way, as they're just shapes with no physical attributes (mass, linear/angular velocities, etc). Only when you add a Rigidbody to a set of colliders, they can respond to physics. Particles can affect rigidbodies just fine, the technical name for this is called two-way coupling (rigidbodies affect particles, and vice-versa) and it is fully supported by Obi.

(20-10-2020, 11:35 AM)Yotingo Wrote: With each particle being assigned it's own bone; are these bones created at runtime or in editor? 
Are the original bone SkinnedMesh assignments overwritten? (Meaning any part of the mesh affected by Obi Softbody is no longer affected by the original bones)

Bones are created at edit time, we don't do this at runtime as its is quite expensive as I already mentioned. New bones are appended to the existing bone list, so all original bones are still fully functional.