question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

skinned mesh loading errors with DracoUnity 2.x/3.x

See original GitHub issue

Hi @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:

dracounity-error

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:

  1. Forking your DracoUnityDemo project.
  2. Adding a Draco-compressed version of the RiggedSimple model as StreamingAssets/RiggedSimple.drc.
  3. 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:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
AwesomesauceLabscommented, Jun 9, 2021

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.

1reaction
AwesomesauceLabscommented, Jun 8, 2021

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 the DracoUnityDemo repo. I think that example may be a very helpful reference in the future, since I am not yet familiar with MeshData and the “Advanced Mesh API”.

For now, I will stick to using the ConvertDracoMeshToUnity method that takes a NativeSlice<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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[RELEASED] Piglet: glTF Importer | Page 4
(Previously, using DracoUnity 2.x/3.x with Piglet 1.3.0 would result in "unfreed collections" errors and/or incorrect GameObject orientations.)
Read more >
Skinned Mesh Error
I'm having a problem with a skinned mesh using shape keys for animation. Every time I load the part in game I got...
Read more >
Draco 3D Data Compression Unity Package
Create the Mesh instance(s) · Apply the data via Mesh.ApplyAndDisposeWritableMeshData · In case the mesh had bone weight data, apply and dispose those...
Read more >
Changing Mesh in Skinned Mesh Renderer : r/Unity3D
Changing the mesh of the Skinned Mesh Renderer causes weird deformations. Hello everyone ! This is my first post here and unfortunately it's ......
Read more >
Skinned Meshes unloading/reloading for unknown reasons
An update in one skinned mesh causes a recalculation in the other. In this case, both skinned meshes, which disappeared for the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found