atteneder / DracoUnity

Draco 3D Data Compression Unity Package
Apache License 2.0
245 stars 38 forks source link

Skinning not working #67

Closed xjedges closed 1 year ago

xjedges commented 1 year ago

I am try to encode and decode the skinning infomation.

The source 'mesh' do have the boneweights, But the output 'meshNew' 's boneweights are missing.

[SerializeField] Mesh mesh;
async void Start()
{
    var results = DracoEncoder.EncodeMesh(mesh, Vector3.one);
    var draco = new DracoMeshLoader(false);
    for (int i = 0; i < results.Length; i++)
    {
        var meshNew = await draco.ConvertDracoMeshToUnity
        (
            new NativeSlice<byte>(results[i].data, 0, results[i].data.Length), true, false, 5, 6
        );
        meshNew.bounds = mesh.bounds;
        AssetDatabase.CreateAsset(meshNew, $"Assets/meshNew{i}.asset");
        results[i].data.Dispose();
    }
    AssetDatabase.SaveAssets();
    AssetDatabase.Refresh();
}

I am not sure if the encoder didn't save the data right or decoder didn't read the data right?