Adding Dual Quaternion support to UnrealEngine4 (Images inside)

1235713

Comments

  • I'm curios about performance. If I use dual quarternion, how much is it heavier than linear?

  • EllessarrEllessarr Posts: 1,390
    edited June 2019

    nvm i found the problem, my current question is if the 4.21 version of the mod is updated to the 4.21.2 version of the unreal and also if the 4.22 is updated to the 4.22.2??, if they already updated to the latest version of the engines.

    Post edited by Ellessarr on
  • EllessarrEllessarr Posts: 1,390

    another question if they are not full upto date you could provide a tutorial to how to proper update the engine to the latest version? if not ask too much

  • dizzy88dizzy88 Posts: 51
    edited June 2019

     

    I've got the same problem (mesh distortion), but with the upper arms, when raised (see my link from the 7th of may). Limiting the weights to 8 in blender looked just fine and smooth in blender, but not in UE4.

    I noticed the same problem, and I'm pretty sure it's because UE4 prunes weights below a certain threshold (0.01 I think).  I don't think there's a good solution except to try smoothing the weights a little in those areas, or editing morphs to compensate.

    Post edited by dizzy88 on
  • dizzy88dizzy88 Posts: 51
    Ellessarr said:

    another question if they are not full upto date you could provide a tutorial to how to proper update the engine to the latest version? if not ask too much

    The 4.22 version works with 4.22.2.

    To update the engine, you just follow the normal process for updating source via Github, then follow the same instructions on Epic's UE4 page to build from source.  If you're not using source control, you probably need to re-download the new version's source from Github.

  • EllessarrEllessarr Posts: 1,390
    dizzy88 said:
    Ellessarr said:

    another question if they are not full upto date you could provide a tutorial to how to proper update the engine to the latest version? if not ask too much

    The 4.22 version works with 4.22.2.

    To update the engine, you just follow the normal process for updating source via Github, then follow the same instructions on Epic's UE4 page to build from source.  If you're not using source control, you probably need to re-download the new version's source from Github.

    normally i use the epic launcher for download and updates.

  • dizzy88dizzy88 Posts: 51

    You cannot use this with the Launcher version of UE4.  You need to build the engine from source after merging in Alienrenders' changes.

  • ateruberateruber Posts: 0

    Tell me, what files have been edited in the source code ?  I would like to add, combine DQS with VXGI UE4.21 if possible.
    Thanks.

  • faky001faky001 Posts: 0

    Is this still active? I would like to try UE4 version with DQS but all i'm getting are error codes 404 on github, did the acount linking thing.

  • CaxarCaxar Posts: 49
    edited June 2019
    faky001 said:

    Is this still active? I would like to try UE4 version with DQS but all i'm getting are error codes 404 on github, did the acount linking thing.

    You need to accept two emails from both Unreal and Github accepting the linking, otherwise it won't work. Its easy to miss as both emails won't arrive at same time and normally only one "confrmation" would be enough , not two from two different companies as is this case.

    Post edited by Caxar on
  • faky001faky001 Posts: 0

     

    Caxar said:

    You need to accept two emails from both Unreal and Github accepting the linking, otherwise it won't work. Its easy to miss as both emails won't arrive at same time and normally only one "confrmation" would be enough , not two from two different companies as is this case.

    Not sure how i missed that mail but it solved my issue thank you!

  • CaxarCaxar Posts: 49
    edited June 2019
    • When building  the engine  I got the version 4.11. No errors, and the quaternions seem to be working. How can I get a more recent version of the engine. I know it has been talked above but  in the installation process I didn't have any moment where I thought I could choose the version, as if this version was predefined in the setup.
    • Do the quaterniun automatically after the build is done or I need to enable anything?
    • When I build the build it works fine, but how can I manage the assets that I create? Not sure where the build is stored as it won't open them in explorer.
    • What I missing about deformation are perhaps corrective morphs. How I can enablem them? There is a video from Inu Games, but how  he gets the pattern of what morph is for what, and can be automatized.
    Post edited by Caxar on
  • AlienRendersAlienRenders Posts: 789
    edited June 2019

    You need to download the version you want, ie. 4.22-mod and build that. Or use git with github to clone the repository then do a "git checkout 4.22-mod".

    4.23-mod will be up shortly after I post this comment. Just waiting on the build to finish to make sure everything compiles.

     

    Post edited by AlienRenders on
  • AlienRendersAlienRenders Posts: 789
    edited June 2019

    I'm curios about performance. If I use dual quarternion, how much is it heavier than linear?

    I never did any performance tests, but overall, it should not be noticeable unless you have a LOT of characters on screen. All the changes are in the vertex or compute shaders, so those don't run nearly as often as pixel shaders. If you only look at the code, the main parts are about equivalent, but the DQ code does two extra steps. 1. It checks for antipodal issues to ensure the shortest rotation is taken. This shouldn't affect performance a whole lot. 2. After all the math is applied, it converts the matrix back to a 4x4 linear matrix so the existing code can keep working. This takes a lot of operations. This is the part that could slow things down. But unless you have a ton of characters on screen, you'll never see the difference. Even then, I very much doubt this will ever affect performance.

    If I could update ALL the shader code and only use DQ code, it's actually possible to get the DQ code to be shorter and faster.

    For more details... suppose you have 8 bone influences per vertex, then the DQS code is run 8 times per vertex. There are fewer DQS operations per vertex than linear blending. But the antipodal check takes extra time. These cancel each other out. There should be very little difference in performance between the two for this part. As to the DQS to linear blending conversion in #2, this is done once per vertex (not 8). So its overall impact should be minimal.

     

    Post edited by AlienRenders on
  • yaruuvvayaruuvva Posts: 33

    Does anyone tried to create a new C++ Project with AlienRenders custom UE4 build? (New Project / C++ / Basic Code)

    After I click "Create Project" button a Visual Studio is launched, but Unreal closes itself...

    I tried 4.22-mod and 4.23-mod branches. Standard Unreal from Epic creates C++ project without problems...

     

  • AlienRendersAlienRenders Posts: 789

    If you run the standalone exe, it works fine even with 4.23-mod. If you launch it from msvc, it will shut down so that msvc will unlock the files and let you build UE4 and any project files if necessary (and delete any temporary files). It doesn't matter either way. Just build your project in development editor and launch that. This will use dll injection when you build your dlls until you shut down the editor where it will unlock the files and delete all the temporary files next time you build with the editor shut down (hence why the editor shuts down when launched from msvc). It shuts down to allow you to delete all the temporary dlls that you may have built last time you had your project open. Yes, it's a new project. But they don't check for that. You could be creating something over top an existing project for example.

    Short story is that everything is working as expected.

     

  • yaruuvvayaruuvva Posts: 33

    Video of a problem: https://streamable.com/zygy6

    @AlienRenders, I launched UE4 from standalone exe. Then I tried to create C++ project and Unreal opens Visual Studio and closed itself. I don't think this is a right behavior...

  • MacislavMacislav Posts: 125
    edited July 2019

    Did anything change from version 4.22.2 DQ to 4.22.3 DQ, because I'm still using the DQ 4.22.2 DQ version and like to ask if the skeletal mesh distortion glitch still persists. (shadows with morph targets are ok in 4.22.2 DQ)

    In blender everything looks smooth and as it should be, so it is not an issue of "limit of total weights", because it looks just fine in blender with weight limit set to 8. (like in ue)

    Blender example is given below. (right arm raised)

    In UE 4 on the other hand (wireframe example, same pose) it looks terrible. I've tested it with an official version of ue (4.22.3) and it was to some extent better (but not perfect) than with your version (4.22.2 DQ).

    I think it's some rounding? glitch in the calculations.

    Can you tell me, which cpp files you've changed, so I could look into the calculations myself?

     

     

    blender perfect.png
    926 x 857 - 278K
    ue 422 dq distortion.png
    1016 x 941 - 159K
    Post edited by Macislav on
  • MacislavMacislav Posts: 125
    edited July 2019

    Update: I could reproduce the glitch in blender by "cleaning all groups with a limit of 0.010", so the problem is not with the calculations, but how UE handles the weights when importing skeletal meshes.

    I knew that UE4 does remove very small bone weights, but I did underestimate the effect it has on skeletal meshes.

    It has something to do with the following message on import of a skeletal mesh:

    "Warning skeletal mesh influence count of 16 exceeds max count of 8. Influence trunctuation will occur. Maximum Ignored Weight 0,013"

    Now the question is: Where in the source code can I change the the number from 8 to 16?

    Post edited by Macislav on
  • MacislavMacislav Posts: 125
    edited July 2019

    Update 2: Limiting the bone weights to 8 in blender didn't help. Even with up to 8 weights per vertex it looks fine in blender, however in UE the glitch persists. Now there is no warning message anymore in UE, but UE seems to remove some weights on import of skeletal meshes in the hidden? What could cause this? In the official version the distortion is not as pronounced as with the DQ version, so I'm not sure whether the calculations in the custom built are causing this to some extent.

    Post edited by Macislav on
  • MacislavMacislav Posts: 125

    Solved: Changing the Minweight in the Source Code from 0.01f to 0.005f has made the mesh more smooth with regard to different animations. Indeed Unreal Engine truncates weights lower than 0.01 in the non modified version, so it has nothing to do with the DQ code.

  • yaruuvva said:

    Video of a problem: https://streamable.com/zygy6

    @AlienRenders, I launched UE4 from standalone exe. Then I tried to create C++ project and Unreal opens Visual Studio and closed itself. I don't think this is a right behavior...

    I debugged the code and it's written specifically that way. I didn't write it, so I can't really help you. I tried commenting out the code that closes the editor and there is later code that checks if the Engine is installed. The comments in the code say that if the Engine is not installed, then it may need to be compiled, so the Editor must close itself. I never tried building the installer when building from source, but maybe you could look into figuring out how to install a built from source engine. That might solve it. But from the code I saw, it looks like the editor tries to switch to the new project. Since it is not built, it cannot switch and ends up just closing itself.

     

  • dizzy88dizzy88 Posts: 51
    Macislav said:

    Solved: Changing the Minweight in the Source Code from 0.01f to 0.005f has made the mesh more smooth with regard to different animations. Indeed Unreal Engine truncates weights lower than 0.01 in the non modified version, so it has nothing to do with the DQ code.

    Is this in SkeletalMeshImport.cpp?  I tried changing it to 0.001 but got very messed up results, even on initial import.  Maybe 0.005 is safer...?

  • There is bug in 4.23-mod, but I'm not sure whether the upstream (4.23-release) also has the same bug. When I tried to import FBX figure (let's say G3F), the materials were not loaded properly. I got "[SM5] (Node TextureSample) TextureSample> Sampler type is Color, should be Virtual Color for ..." So I had to change the Sample Type from Color to Virtual Color for all textures.

     

    4.22.3-release from upstream works just fine. I haven't tried the 4.22-mod version.

  • I debugged the code and it's written specifically that way. I didn't write it, so I can't really help you. I tried commenting out the code that closes the editor and there is later code that checks if the Engine is installed. The comments in the code say that if the Engine is not installed, then it may need to be compiled, so the Editor must close itself. I never tried building the installer when building from source, but maybe you could look into figuring out how to install a built from source engine. That might solve it. But from the code I saw, it looks like the editor tries to switch to the new project. Since it is not built, it cannot switch and ends up just closing itself.

    I can reproduce this case in 4.22.3-release from upstream. So in my opinion, if this is considered as a bug then it's an upstream bug.

  • MacislavMacislav Posts: 125

    @dizzy88:

    Yes, it's in this file:
    Engine/Source/Editor/UnrealEd/Private/Factories/SkeletalMeshImport.cpp

    --> const float MINWEIGHT = 0.01f

    I had the issue with 0.001f as well, but 0.005f works perfectly.

  • yaruuvvayaruuvva Posts: 33
    edited September 2019

    @AlienRenders, 4.23 is out! Could you update your UE4 fork to support it? 

    Post edited by yaruuvva on
  • yaruuvva said:

    @AlienRenders, 4.23 is out! Could you update your UE4 fork to support it? 

    Check this page https://github.com/AlienRenders/UnrealEngine/tree/4.23-mod

  • yaruuvva said:

    @AlienRenders, 4.23 is out! Could you update your UE4 fork to support it? 

    Check this page https://github.com/AlienRenders/UnrealEngine/tree/4.23-mod

    Thanks! I noticed that branch 4.23 was merged into 4.23-mod one month ago. Maybe there were some changes in UE4 source code since then...

  • It seems there are a few of us here that are really new to Github and building/updating UE4 from the source files. I can download the mods and get them to build but the updating/merging process I still don't understand.

    If the 4.23-mod was merged a month ago with the 4.23 preview 1(im guessing) what is the process to update to 4.23.0? Is it already up to date with 4.23.0

    Or should we start with 4.23.0 and merge in the mod ourselves. How do we do that if the mod was already merged.

    How do we update when 4.23.1 is released.

    I did find some documentation on updating UE4 grom source code but I'm not sure if it's any different when using a modded version.

    If anyone would mind putting together a quick guide it would be very appreciated,

    Thank you.

Sign In or Register to comment.