Skip to content
No description, website, or topics provided.
C# ShaderLab HLSL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Dual quaternion skinning for Unity


  • GPU skinning with compute shaders (only)
  • blend shape support (calculations performed in compute shader)
  • works with any platform that supports compute shaders
  • preserves volume with deformation (look comparison)
  • zero GC allocations per frame
  • original bulging compensation method (alpha-testing, not ready for real-world applications yet)


Gif Difference


You will not see any effect in edit mode.
The scipt only works in play mode.
If you see no effect in play mode verify that you are using the right shader.

Unity version

The script was tested with following Unity versions:

  • 2019.2.9f1


During my testing the amount of time spent on actual skinning was negligible compared to the amount of time extracting localToWorldMatrix from every bone in the hierarchy.

As long as you are not creating hundreds of characters with complex rigs (no matter the polycount) there should be no significant performance hit.

If anyone knows how to optimize extracting localToWorldMatrix of the bones please create an issue or message me on unity forum.

How to set up:

  • Create a skinned character with SkinnedMeshRenderer component
  • Add DualQuaternionSkinner.cs component (it will require a MeshFilter component)
  • Enable mesh Read/Write in import settings

* All materials of the mesh should use a special shader to apply vertex positions. The shader is `MadCake/Material/Standard hacked for DQ skinning`

Common problems

The script is programmed to automatically detect common setup problems. Check out the editor:

Why do i need SkinnedMeshRenderer?

My scripts uses SkinnedMeshRenderer to extract an array of bones from it. Yep, that's it.
The order of bones is unpredictable and does not depent on their hierarchy.
Only SkinnedMeshRenderer knows it    ¯\_(ツ)_/¯

After extracting the bone array in Start() my script disables SkinnedMeshRenderer component as it is no longer needed. All the animations are performed by the script. You can verify it in the editor after hitting play button.

How do I use custom shaders?

Alas it's complicated.
I added comments to "Standard hacked for DQ skinning" marking the alterations i made to the Standard shader.
You can try to do the same with your own shader to make it work with the script.

Feel free to contact me in this thread at unity forum if you need help.

I would also like to hear about your projects that use my script and your experience with it.



Future plans

  • Test/fix/improve bulging compensation
  • It might make sense to group the data from all instances of the script into one batch and run the compute shaders only once per frame regardless of how many animated characters you have

Known bugs / problems

  • Bulging compensation appears to make facial animation look a bit more stiff and robotic


If you have any questions, ideas, bug reports, or just want to discuss the script, you can contact me on unity forum

You can’t perform that action at this time.