Adding Dual Quaternion support to UnrealEngine4 (Images inside)

AlienRendersAlienRenders Posts: 793
edited August 2020 in Unreal Discussion

I added dual quaternion support in UnrealEngine4 locally. It doesn't support scaling because that's a bit more complicated, but it now means that joints now bend properly and that morphs, especially JCM's, will appear correctly if I decide to use them. So I took some screenshots of a simple tube with two bones imported and rigged in DAZ Studio and then exported to UE4. Screenshots show LBS (linear blending skinning) and DQS (dual quaternion skinning) in UE4. So if you wanted to know the difference between regular skinning and dual quaternion skinning, here you go.

The biggest improvement with DQS is that it preserves volume and does corkscrew rotations instead of collapsing like twisting a wrapper. Here are pics explaining that.

And a 90 degrees twist in DQS just to show how it looks without extreme rotations.

 

lbs160twist.png
800 x 652 - 397K
dqs160twist.png
800 x 652 - 397K
dqs90twist.png
800 x 652 - 394K
Post edited by DAZ_Rawb on
«13456714

Comments

  • Here are some images for bending.

    70 degrees bend.

    And 110 degrees bend.

    As you can see, Dual Quaternion Skinning does have a side effect of slightly bulging when bending a lot. Apparently, there are ways to get rid of this, but I suppose JCM's can do this too.

     

    lbs70bend.png
    800 x 652 - 394K
    dqs70bend.png
    800 x 652 - 395K
    lbs110bend.png
    800 x 652 - 395K
    dqs110bend.png
    800 x 652 - 398K
  • DQS already sounds dated. Any thoughts on implementing RTSS?

  • I did not find anything on RTSS. As for DQS, it is used by Genesis 3, so everyone using the most recent DAZ figures can now use them in UE4 with proper deformations. I really like DAZ products and this should benefit everyone using G3F/M in UE4 as I'm making this code freely to everyone on my 4.14 branch on github (AlienRenders account) when I'm done cleaning up the code.

     

  • UE3 already had support for DQS though it required access to the full source engine version and was not enabled for games. UE4 dropped support for DQS.

    DQS still suffers from texture stretch deformations and bulging artifacts whereas RTSS optimizes centers of rotation to minimize those issues. Though it is fairly new concept (July 2016), the results show quite an improvement especially in areas where both bend and twist deformations are involved due to lack of bulging artifacts. How it performs for high poly meshes is something to watch out for.

  • Singular3DSingular3D Posts: 532

    This works the same in Cinema 4D when spherical skinning. With the original JCMs from Genesis 3 the bulging effect is reduced. Additionally Cinema 4D provides a blend mode (percentage) to combine LBS and DQS. Might be useful in UE as well.

  •  

     

    I'm making this code freely to everyone on my 4.14 branch on github (AlienRenders account) when I'm done cleaning up the code.

     

    Did you made it?

  •  

     

    I'm making this code freely to everyone on my 4.14 branch on github (AlienRenders account) when I'm done cleaning up the code.

     

    Did you made it?

    We hope that a process will continue  https://www.daz3d.com/forums/discussion/134541/math-dual-quaternions-with-scaling-how/p1

    Dear AlienRenders we all watching your work and hope you made it!

  • InuGamesInuGames Posts: 65
    edited January 2018

     

     

    I'm making this code freely to everyone on my 4.14 branch on github (AlienRenders account) when I'm done cleaning up the code.

     

    Did you made it?

    We hope that a process will continue  https://www.daz3d.com/forums/discussion/134541/math-dual-quaternions-with-scaling-how/p1

    Dear AlienRenders we all watching your work and hope you made it!

    I hope too, because it's absolutely amazing! I was trying to adapt Daz morphs to UE4 before, spent mounts without success... With AlienRenders's mod it was soo easy to move daz ppl to unreal!! Of course, there is still lot of work except jcms, like skin,eyes, lod, dynmaic clothes, etc. etc. But DQ skinning was the real roadblock.

    Examples pics and video of Victoria8 in modded UE4, DQ jcms in action:  https://crazyrestosim.wordpress.com/2018/01/30/victoria-goes-to-the-beach-video/

    Thank you AlienRenders!

     

     

    Post edited by InuGames on
  • Is this build of UE4 still available?  Does anyone have a link?  Or are there other options to get DQ skinning into UE4?

  • AlienRendersAlienRenders Posts: 793
    edited February 2018

    All my branches on github under AlienRenders that have -mod in it have DQ. You can cherry pick the revision(s) for DQ if you don't want TIFF support.

    And to those asking, yes I wrote it. The link that someone indicates was given to me AFTER I had written the code and the code is somewhat different anyhow. I only used it to know where to put the scaling which wasn't available at the time. I did it my own way anyhow. If I could rewrite how the skinning is done, I'd do it more like the way in the link as it's faster, but it'd be too much refactoring.

     

     

    Post edited by AlienRenders on
  • Oh wow, so it looks like you have a 4.18 also?  This is great - will try building it when I can.  Thanks a ton!

  • I couldn't find your github in google. could you let me know your github address? I hope to use your DQ mod for ue4.

     

     

  • AlienRendersAlienRenders Posts: 793
    edited March 2018

    https://github.com/AlienRenders/UnrealEngine

    The releases with -mod have the DQ skinning. You can cherry pick the revisions you want (the DQ specific ones) into your own branch if you don't want TIFF support.

    For those who want to compile TIFF support...

    Launch the developer x64 command prompt for VS2015/VS2017
    Go to your UE4 folder.
    cd Engine\Source\ThirdParty\libTIFF
    UE4_BuildThirdPartyLib.bat

    Then build UE4.

     

    Post edited by AlienRenders on
  • I merged in just the DQS files (11 total?) and it compiles and seems to work beautifully.  Thanks so much!

  • Hi fellow mod-DQ users

    Do you guys experience this strange problem like on the picture? This dark area appearing when bending and applying morphs. I believe it's caused by normals not working correctly with morphs. I also have this in normal UE, actually in dq-mod it's much less visible.

    Does someone know how to solve it?

    Capture.PNG
    1235 x 733 - 730K
  • Is DQ needed too for Genesis 8?

    I will wait for UE4 4.19 release and than test that if it is needed for better support.

  • InuGamesInuGames Posts: 65
    edited February 2018

    Is DQ needed too for Genesis 8?

    Yes

    To elaborate: if you have animations that rotate bones more than let's say 45° it will start to look ugly.  At 90° or more it will be ugly. And you cannot use Daz morphs either, they will do even worse. I added some images below to illustrate how it will look. Typically knees and elbows will collapse and arm twists will collapse too. In crouch pose thigh will collapse but pelvis will not etc. In short you will not have beautiful Daz character but something ugly. Now, if you dont move too much or your character is some kind of monster or if you don't care then it will be ok even without the mod.

     

    Images of how it look without DQ bellow. With DQ it looks as apretty as in Daz (very pretty)

    ScreenShot00000.png
    836 x 885 - 801K
    ScreenShot00001.png
    836 x 885 - 837K
    ScreenShot00002.png
    836 x 885 - 842K
    Post edited by InuGames on
  • @AlienRenders what about too create an pr for the official engine git repo?

  • UE used to have DQ and they removed it because they felt it took too much time and resources to maintain two different code paths. They also mentioned the lack of people using it. I could try adding a pull request, but then I'd have to update the CPU only code path to support DQ to be fully supported and I don't really have time to do that atm.

     

  • nekyonekyo Posts: 54

    @AlienRenders Thought this looked really interesting, was going to try it out but getting a 404 error at your github page.

    https://github.com/AlienRenders/UnrealEngine

    Is it still available?

    Thanks

  • dizzy88dizzy88 Posts: 51
    nekyo said:

    @AlienRenders Thought this looked really interesting, was going to try it out but getting a 404 error at your github page.

    https://github.com/AlienRenders/UnrealEngine

    Is it still available?

    Thanks

     

    You need to:

    1. Sign up for an EpicGames account at www.unrealengine.com

    2. Sign up for a Github account www.github.com

    3. Go to your EpicGames account info page and connect your Github account using your Github username (under "Connected Accounts")

    Then you'll have access.

  • nekyonekyo Posts: 54
    dizzy88 said:

    You need to:

    1. Sign up for an EpicGames account at www.unrealengine.com

    2. Sign up for a Github account www.github.com

    3. Go to your EpicGames account info page and connect your Github account using your Github username (under "Connected Accounts")

    Then you'll have access.

    Gah, yep I didn't realize I needed set the accounts up first before I could even look at the page :P

    Thanks dizzy88!

  • Hello AlienRenders,

    Could you pack your changes as a plugin so it could be used with any version of UE4?

  • ParadigmParadigm Posts: 421
    edited March 2018

    Are porting models into UE4 difficult?

    Post edited by Paradigm on
  • Paradigm said:

    Are porting models into UE4 difficult?

    A few years ago DAZ Genesis 1 and 2 were not compatible with UE4. I believe it was fixed in version 4.12. In 4.17, 4.18, 4.19 it can be exported from DAZ and imported to UE4 without needing to use other external programs like 3DS Max, Maya and Blender.

  • @AlienRenders could you maybe create an 4.19 patched branch please?

  • InuGamesInuGames Posts: 65

    +1 for 4.19, there is so much good stuff in there!

    Does AlienRenders or someone looking to port it? I was thinking to try myself, but I don't know this stuff very well so it will take me much time.

    Btw, there is an update to 4.18-mod branch 1 week ago, something about skin cashe shaders.

  • dizzy88dizzy88 Posts: 51

    Btw, there is an update to 4.18-mod branch 1 week ago, something about skin cashe shaders.

    There was a problem that caused a crash when "Support Compute Skincache" was enabled in Project Settings, which AlienRenders generously fixed.  It's probably not going to affect you unless you have that option turned on, which most people probably won't.

  • Hello guys,

    I've merged AlienRender changes into 4.19 branch, but I have no opportunity to check if it works fine. Could someone build the editor and check if it works?

    Here is the link

    https://github.com/PavloGrubyi/UnrealEngine/tree/master

    Thank you

  • InuGamesInuGames Posts: 65

    Hello guys,

    I've merged AlienRender changes into 4.19 branch, but I have no opportunity to check if it works fine. Could someone build the editor and check if it works?

    Here is the link

    https://github.com/PavloGrubyi/UnrealEngine/tree/master

    Thank you

    Thank you! I will check it out.

Sign In or Register to comment.