Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Dual quaternion skinning for Unity

Discussion in 'General Graphics' started by mr_madcake, Oct 22, 2017.

  1. Holoboost

    Holoboost

    Joined:
    Jul 6, 2020
    Posts:
    4
    Hi there, this looks really awesome. Does this technique work on mobile (oculus quest), using opengles? Is there any way to run this on unity 2018 LTS?
     
  2. mr_madcake

    mr_madcake

    Joined:
    Jul 17, 2017
    Posts:
    90
    Hi

    I haven't tried but theoretically it should work. Have you encountered some issue with it?
     
  3. Holoboost

    Holoboost

    Joined:
    Jul 6, 2020
    Posts:
    4
    No, but I haven't because I didn't know if it would work on 2018 LTS due to the multi_pragma_compile issue. But now that you mentioned it should, I can give it a shot. Just wondering how much a performance hit it is compared to normal skinning, since we are heavily GPU bound right now,
     
  4. mr_madcake

    mr_madcake

    Joined:
    Jul 17, 2017
    Posts:
    90
    It's hard to give a clear number as it scales differently with different things. From my benchmarks I could not get worse performance drop than 30% compared to built-it skinning in purposefully built worst-case scenario, but it could vary wildly depending on the project.

    Also CPU hit from extracting bone transform matrices affected performance the most, there should be no big issue with GPU.

    If you want good performance I strongly recommend using IL2CPP compiler as is properly optimizes bone transform matrix extraction (I made the benchmarks with IL2CPP). Mono uses some really weird shenanigans that slow down the script A LOT.

    This line in particular is A LOT slower in Mono and in profiler it reportedly calls to String.memcpy() for no apparent reason.

    If you don't need the bulging compensation you can remove this part of the shader for a little extra performance. This will leave you with traditional DQ implementation.
     
    Last edited: Jul 14, 2020
  5. vladibalan

    vladibalan

    Joined:
    Sep 14, 2014
    Posts:
    6
    I have a mesh with 4332 vertices (so vertNumber/textureWidht = 4). If I use GetVertexTextureHeight in Update it is rendered garbled at runtime (I did not investigate yet why a textureHeight of 5 instead of 4 makes it do that).
    upload_2020-7-18_17-17-2.png

    Anyway, i'm posting this in case anybody else has this problem. I've reverted the line in Update to the previous form to solve the issue: this.materialPropertyBlock.SetInt("skinned_tex_height", mf.sharedMesh.vertexCount / textureWidth);
    Observation: there are multiple meshes using DualQuaternionSkinner (different vertex count, all of them worked but this one). Again, I don't know yet why, the only difference is that all the other meshes have a texture height ratio lesser than 4 (0,1,2,3).
    PS: I am using Unity 2019.4.4f1 Personal.
     
  6. sihan66

    sihan66

    Joined:
    Aug 26, 2020
    Posts:
    2
    Get the mesh of DQ blending skinning:
    I have implemented the dqls in my own project. And I want to get the mesh of human model of dqls in obj format. However, I found i get the obj model of lbs. How can i get the mesh of dqls? Thank you.

    ![dqls in unity](https://user-images.githubusercontent.com/58064039/91283618-68203d80-e7bd-11ea-8e36-63409b4b9d02.png)
    ![export lbs in obj](https://user-images.githubusercontent.com/58064039/91283629-6bb3c480-e7bd-11ea-8394-135c43a4dad0.png)
     
  7. sihan66

    sihan66

    Joined:
    Aug 26, 2020
    Posts:
    2
     
  8. mr_madcake

    mr_madcake

    Joined:
    Jul 17, 2017
    Posts:
    90
    Hi.

    I am a bit confused about what are you trying to achieve.

    OBJ format does not support animation, it is a static model. For animated models you would usually use FBX.
    Are you trying to make a static model from a single frame of animation in Unity?

    My script only works in Play mode, so if you are trying to export the model in Edit mode, you would get the model with built-in linear skinning.
     
  9. mr_madcake

    mr_madcake

    Joined:
    Jul 17, 2017
    Posts:
    90
    Could you try this version of the script with the same model?
    I would like to make sure that these issues are not connected.

     
  10. Ldnicon

    Ldnicon

    Joined:
    May 22, 2016
    Posts:
    4
    Any updates on the distortion of meshes?

    I've tried DualQuaternionSkinner.cs on different models, but they all look extremely distorted.
     

    Attached Files:

unityunity