Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Export Obi Cloth Simulation as Alembic File
#1
Hello there,

I have a scene with a human avatar wearing a shirt(the garment is divided in separate parts like: front/back torso, sleeves etc). I have succesfully created (you helped me in another thread !) a script that creates all obi components and adds them to the Shirt. 

Everything is working fine so far. 

Using the Alembic library from the package manager, im able to export the scene into an alembic format.

However, when i load and play  the new alembic object in the scene the shirt dissapears in the alembic animation after a while. I tried to export the same avatar/shirt before adding the OBI components and in this case the alembic animation works fine. What i mean is that when the shirt is OBI, it dissapears from the alembic.

Do you possibly have any idea/solution of why this happens?

Thanks a lot beforehand!
Reply
#2
(13-05-2021, 01:28 PM)orestissar Wrote: Hello there,

I have a scene with a human avatar wearing a shirt(the garment is divided in separate parts like: front/back torso, sleeves etc). I have succesfully created (you helped me in another thread !) a script that creates all obi components and adds them to the Shirt. 

Everything is working fine so far. 

Using the Alembic library from the package manager, im able to export the scene into an alembic format.

However, when i load and play  the new alembic object in the scene the shirt dissapears in the alembic animation after a while. I tried to export the same avatar/shirt before adding the OBI components and in this case the alembic animation works fine. What i mean is that when the shirt is OBI, it dissapears from the alembic.

Do you possibly have any idea/solution of why this happens?

Thanks a lot beforehand!

Hi,

It's hard to say without taking a direct look at it. Maybe you're using the same (shared) mesh for both Alembic and Obi?

If you could send a repro project to support(at)virtualmethodstudio.com I'll be glad to take a look.
Reply
#3
(21-05-2021, 08:49 AM)josemendez Wrote: Hi,

It's hard to say without taking a direct look at it. Maybe you're using the same (shared) mesh for both Alembic and Obi?

If you could send a repro project to support(at)virtualmethodstudio.com I'll be glad to take a look.
Hi,
I m not sure how i can actually do that. I can try export it as unity package but i dont think it will make much sense to you.

I ll try share some screenshots with you.

So in the first one, u can see the object's hierarchy i try to export as alembic.
[Image: 95GSEuC.png]
[Image: PzuPlqv.png]
[Image: n323Nvs.png]
The Object named OBI is the solver component and all the children are working OBI's.

The alembic exporter script is the official script from the Unity Packages.

I just feel like the "OBI information" is lost during the alembic export process. and this results into the shirt dissapearing.

My goal is to export an alembic file, that contains the same animation as if it was a runtime obi simulation.
Reply
#4
I can't see anything wrong with your settings. Tried this myself, but can't reproduce any weird behavior.

Quote:I just feel like the "OBI information" is lost during the alembic export process. and this results into the shirt dissapearing.

Obi stores all information as particle data. Unless Alembic is purposely tinkering with particles (which is likely not the case), I can't think of any reason for this data to be lost.

I think the only way to solve this is for me to take a loot at your scene/project directly. If possible share a unity package, will see if I can help you that way.
Reply
#5
(24-05-2021, 09:04 AM)josemendez Wrote: I can't see anything wrong with your settings. Tried this myself, but can't reproduce any weird behavior.


Obi stores all information as particle data. Unless Alembic is purposely tinkering with particles (which is likely not the case), I can't think of any reason for this data to be lost.

I think the only way to solve this is for me to take a loot at your scene/project directly. If possible share a unity package, will see if I can help you that way.
Hey again! I will try send you my unity package with WeTransfer! 
Thank you so much for your time and help!
Reply
#6
(24-05-2021, 11:22 AM)orestissar Wrote: Hey again! I will try send you my unity package with WeTransfer! 
Thank you so much for your time and help!
Hello !

Do you have any update on this?
Reply
#7
(01-06-2021, 09:32 AM)orestissar Wrote: Hello !

Do you have any update on this?

Hi,

I see you're using skinned cloth instead of regular cloth.

Unity's SkinnedMeshRenderer does not accept meshes with no bone weights, which is required for cloth simulation. So Obi removes the mesh from the SkinnedMeshRenderer and renders it itself using Graphics.DrawMesh. You can see the code for this is ObiSkinnedClothRenderer's UpdateRenderer() method.

What Alembic does is it exports SkinnedMeshRenderer's sharedMesh data (since it knows nothing about Obi). So once you enable Obi's LateFixedUpdater component in your code, Alembic will cease to export data for the mesh (as it has moved from SkinnedMeshRenderer's sharedMesh to ObiSkinnedClothRenderer's clothMesh). This is why the cloth disappears from alembic file after a while: you enable the updater after a while using a coroutine, and right at that moment, Obi "hijacks" mesh rendering and Alembic loses track of the mesh.

There's several possible solutions. One would be modifying the AlembicExporter_impl to deal with ObiSkinnedClothRenderer. Another, simpler possibility is to write a simple component that takes the cloth mesh and puts it in a regular MeshRenderer so that Alembic can pick it up. Like this:

Code:
using UnityEngine;
using Obi;

[RequireComponent(typeof(SkinnedMeshRenderer))]
public class SkinnedClothAlembicExposer : MonoBehaviour
{
    MeshFilter filter;
    ObiSkinnedClothRenderer clothRenderer;

    void Start()
    {
        GameObject alembicCloth = new GameObject(gameObject.name + "(Alembic)",typeof(MeshFilter),typeof(MeshRenderer));
        alembicCloth.transform.parent = transform;
        filter = alembicCloth.GetComponent<MeshFilter>();
        alembicCloth.GetComponent<MeshRenderer>().material = GetComponent<SkinnedMeshRenderer>().material;
    }

    private void LateUpdate()
    {
        clothRenderer = GetComponent<ObiSkinnedClothRenderer>();
        if (clothRenderer != null)
            filter.sharedMesh = clothRenderer.clothMesh;
    }
}

Adding this to each of your cloth SkinnedMeshRenderers, it will create a child gameobject with a MeshRenderer and feed it Obi's clothMesh so that Alembic can pick it up. Remember to untick AlembicExporter's Static MeshRenderers checkbox, or it will ignore MeshRenderers too.

kind regards,
Reply
#8
Thank you so much for all this feedback!
I need to check all these and i will get back to you with updates! I hope I will make it work!

Thank you a lot and I appreciate the help!
Reply