skinned mesh loading errors with DracoUnity 2.x/3.x
See original GitHub issueHi @atteneder!
Unfortunately, I’m experiencing some issues when loading skinned meshes with DracoUnity 3.0.2 (Unity 2020.3.9f1).
The loaded bone indices/weights data seem to be incorrect/uninitialized, and in addition I am seeing the following error in the Unity console:
Sorry about the lack of stack trace, btw. So far I can’t figure out how to “Enable Full StackTraces to get more details.” I know there’s supposed to be an item in the Unity “Jobs” menu to do that, but I don’t see it. (Frustrating!)
Minimal Test Case
I created a minimal project to reproduce the issue by:
- Forking your DracoUnityDemo project.
- Adding a Draco-compressed version of the RiggedSimple model as
StreamingAssets/RiggedSimple.drc
. - Changing
DracoDemo.cs
code to load the model with (hopefully) correct parameters.
You can get my test case by cloning https://github.com/AwesomesauceLabs/DracoUnityDemo. (It’s the HEAD commit on the main
branch.)
Creating RiggedSimple.drc
RiggedSimple.drc
is included in https://github.com/AwesomesauceLabs/DracoUnityDemo, but since creating the file was tricky, I wanted to document the steps here:
# clone the sample models
git clone git@github.com:KhronosGroup/glTF-Sample-Models.git
# This directory contains: RiggedSimple.gltf, RiggedSimple0.bin
cd glTF-Sample-Models/2.0/RiggedSimple/glTF
# make a subdir for the Draco-compressed glTF file
mkdir Draco
cp * Draco
cd Draco
# Draco-compress the glTF file.
# This generates a new RiggedSimple0.bin, which contains both the
# uncompressed animation data and the Draco-compressed mesh data.
gltf-transform draco RiggedSimple.gltf RiggedSimpleDraco.gltf
# Extract the Draco blob from RiggedSimple0.bin.
# I had to look through RiggedSimpleDraco.gltf to determine the
# correct `skip`/`count` values.
dd iflag=skip_bytes,count_bytes skip=2328 count=1000 if=RiggedSimple0.bin of=RiggedSimple.drc
Expected Bone Indices/Weights vs. Observed Bone Indices/Weights
Expected: bone-weights-standard.tsv.txt Observed: bone-weights-draco.tsv.txt
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (5 by maintainers)
Thanks for the kind words, @atteneder 😃
I think the notes/code you added to the README.md are quite helpful, so thanks for that too.
Thanks for your help, @atteneder!
Yes, you are right and it was my error. I misread your code and I failed to notice that some of the method signatures for
ConvertDracoMeshToUnity
are different in Unity 2020.2+ (due to#if
/#else
blocks).Thanks also for adding the
DracoDemoMeshData.cs
example to theDracoUnityDemo
repo. I think that example may be a very helpful reference in the future, since I am not yet familiar withMeshData
and the “Advanced Mesh API”.For now, I will stick to using the
ConvertDracoMeshToUnity
method that takes aNativeSlice<byte>
as input, since that method is straightforward to use and is available across all Unity versions. (So far it is working well, although I still have a bit more testing to do.)Closing the issue now.