As I've mentioned many times, the DQ stuff cannot be made into a plugin as it changes the main behaviour of the engine.
When i donwload the unreal engine source from your github it takes 3x more space than same version of the original Epic games store version and also the second problem is when i delete a project that is created from your -mod and i create a new one it still takes up space from my disc(around 1 gb), why does it happen. to download the -mod it took me 60-70 gb and to build the UE4 took me another 60 gb.
I understand you cant make it as a plugin so, Is there a way to merge only the necessery dual quaternion scripts instead of downloading the entire source because it takes way more space than the original Unreal verion, if there is a way can you or anyone here explain what to add and delete? (im talking modifying/adding/deleting scripts from unreal engine 5-mod to unreal engine 5 original)
i tried to remove and add what github showed but it ended up with errors
I would like to second the thoughts in the above post. I've succesfully gotten DQ skinning to work in multiple 4.xx versions of Unreal. However, the folder sizes balloon into these huge, bloated messes.
Why? Why is this necessary? You said yourself that the base default version of Unreal even includes a bit of the things that used to be added by this hack.
I really appreciate and respect all the people involved in modifying Unreal to work better with Daz characters. And I understand that with the big MetaHuman push from Epic they are vanishinly unlikely to officially make it a smooth process to bring in human characters from other software.
But for real, is there any way possible, any way at all, to just edit things under the hood of the usual Unreal install, and thus avoid these bloated doppleganger versions that take forever to download and compile?
I converted a project from 4.26.2 to 4.26.0-mod, Daz Character looks fine, but my Metahuman Character looks very weird. Is there a way to compatible two characters?
I'm looking at my UE5 folder and it's 260GB. That's insane. Looks like the branch I cut from had tons of plugins and that's the official 5.0 release. Not sure these are all necessary. There's 70GB in there after it's built. Intermediate folder is 80GB. I think it's building everything. I might take a look this weekend and see if I can update and cut down the build somewhat. I'll prioritize the update first. BTW, it's not my build. I just merged my code changes. The build should be identical to the stock UE5 build. Hopefully, it'll be cut down with the new update.
I do want to try to include on option to switch DQS on or off at some point. Just gotta find the time.
Oh, and I'm thinking of doing a pull request to the official UE5 branch to get at least the math DQ changes added. They're just math functions and don't need to be maintained. I just have to find how they run their unit tests if they have any.
Anyways, the goal of that is that right now changing the math code affects everything. But if it's already in the official build, it would only be one or 2 dll's and some shaders that change to get DQS to work. I could maybe create a patch install for official releases. So you'd install the official release, then the patch and you have DQS. Problem there is forcing the shaders to rebuild but I think I can fix that too.
Also, the more stuff is in the official build, the likelier it is that they would include full DQS eventually.
Once I get the option to turn on/off DQS and fix the morph issues with it, I think I'll try a pull request on the main ue5 branch. The worst that can happen is they say no. If they say yes, then we're all set.
I updated 5.0-mod. To build with your compiler start a x64 native tools command prompt for the VS version you want to use. If you get an error about unrealbuildtool.dll not being built, type this:
set Platform=
Then run GenerateProjectFiles.bat again.
And yes, there's nothing after the equal sign.
I haven't built this one yet. I may only have time this weekend.
Oh, and I'm thinking of doing a pull request to the official UE5 branch to get at least the math DQ changes added. They're just math functions and don't need to be maintained. I just have to find how they run their unit tests if they have any.
Anyways, the goal of that is that right now changing the math code affects everything. But if it's already in the official build, it would only be one or 2 dll's and some shaders that change to get DQS to work. I could maybe create a patch install for official releases. So you'd install the official release, then the patch and you have DQS. Problem there is forcing the shaders to rebuild but I think I can fix that too.
Also, the more stuff is in the official build, the likelier it is that they would include full DQS eventually.
Once I get the option to turn on/off DQS and fix the morph issues with it, I think I'll try a pull request on the main ue5 branch. The worst that can happen is they say no. If they say yes, then we're all set.
that would be amazing, we really need this fix because currently is really hard to work with daz characters in unreal with dq and the new ml deform looks abit bonk currently to be a really viable way.
I updated 5.0-mod. To build with your compiler start a x64 native tools command prompt for the VS version you want to use. If you get an error about unrealbuildtool.dll not being built, type this:
set Platform=
Then run GenerateProjectFiles.bat again.
And yes, there's nothing after the equal sign.
I haven't built this one yet. I may only have time this weekend.
i have visual studio 2019/2022 and it says i need to use visual studio 2015. still not working
UE5 doesn't build with 2015. So something is out of whack. Working on 5.1 right now.
edit: 5.1-mod should be ready.
I tried looking at disk usage and it's 25GB of source at the start. Then Setup downloads 20GB of dependencies but the UE5 folder grows to 100GB. Then the actual build grows to 205GB. I tried building an install, but it's taking forever as it has to build the developer editor and the game runtime, so it builds everything twice. If I have time later, I'll try building 5.1 without my changes and see what it does.
UE5 doesn't build with 2015. So something is out of whack. Working on 5.1 right now.
edit: 5.1-mod should be ready.
I tried looking at disk usage and it's 25GB of source at the start. Then Setup downloads 20GB of dependencies but the UE5 folder grows to 100GB. Then the actual build grows to 205GB. I tried building an install, but it's taking forever as it has to build the developer editor and the game runtime, so it builds everything twice. If I have time later, I'll try building 5.1 without my changes and see what it does.
Another question is when i delete a project in unreal engine build it wont delete the entire space is it a bug or how do i delete the entire project so i can have the same amount of GB as i had before creating it?
Make sure to back up anything you need before doing anything suggested here...
I usually have a C++ UE project in a different folder all together. So when you delete a project, you delete the source folder manually. You can go into the editor and delete it, but that's just to remove it from the list. I haven't removed projects from the editor in ages, sorry.
The thing is these projects would be tiny in comparison if you've just created the basic projects and haven't done much work on it. It sounds like you want to delete a UE build all together. That's a whole different ballgame. Again, you would delete the folder you used for the UE build. I'm afraid I'll need more info on what you're trying to do exactly.
If you mean that you want to start your build over, you can do "clean" in Visual Studio to remove all the object files and dll's. That'll leave you with just the original source (though I don't think it removes everything it built like shaders). Third party dependencies will still be there. So you'll be back to around 100GB. To go below that, you'll need to delete the UE folder and redo git clone. Not sure why you would want to do this if it built correctly.
If you're trying to remove a previous version (like you built 5.1 and don't want 5.0 anymore), then you just delete the 5.0 folder. You may need to upgrade your personal projects to use 5.1. I haven't upgraded local projects yet.
Remember that on Windows, deleted files go in the Trashcan unless it's too big to fit. So to regain the space, don't forget to empty the Trashcan.
I'm updating 5.1 (and 5.1-mod). Looks like I update exactly when the build was broken. I'm seeing a possible fix in the logs, so updating again since my last update earlier. So if you're getting an error generating the project files, try again later. Hopefully, this will be sorted out soon.
Also, I'm going full time into developing my own game. It's not one that requires DAZ characters (for the first game), but hopefully I'll be able to finally finish the option to toggle DQS on/off soon-ish. And I will make a pull request to get at least the quaternion changes added to the main codebase. I just need to figure out where they have their unit tests.
edit: 5.1-mod appears to be updated and working again. I haven't built it yet, but it now generates the project files at least.
Make sure to back up anything you need before doing anything suggested here...
I usually have a C++ UE project in a different folder all together. So when you delete a project, you delete the source folder manually. You can go into the editor and delete it, but that's just to remove it from the list. I haven't removed projects from the editor in ages, sorry.
The thing is these projects would be tiny in comparison if you've just created the basic projects and haven't done much work on it. It sounds like you want to delete a UE build all together. That's a whole different ballgame. Again, you would delete the folder you used for the UE build. I'm afraid I'll need more info on what you're trying to do exactly.
If you mean that you want to start your build over, you can do "clean" in Visual Studio to remove all the object files and dll's. That'll leave you with just the original source (though I don't think it removes everything it built like shaders). Third party dependencies will still be there. So you'll be back to around 100GB. To go below that, you'll need to delete the UE folder and redo git clone. Not sure why you would want to do this if it built correctly.
If you're trying to remove a previous version (like you built 5.1 and don't want 5.0 anymore), then you just delete the 5.0 folder. You may need to upgrade your personal projects to use 5.1. I haven't upgraded local projects yet.
Remember that on Windows, deleted files go in the Trashcan unless it's too big to fit. So to regain the space, don't forget to empty the Trashcan.
I want to delete a project i created with the mod(Not the entire build) a project like third person shooter when i delete my project that is in "Unreal projects" it still going to keep some space.
I had 117 free gb after i built ue 4.26-mod. Then i created a project and imported my daz characters and it went down to 108gb. After I deleted my project(Not build) it went to 115 gb so 2 gb of my project are still hiding somewhere in my PC. How do i delete all my project?
How to download single files from GitHub:
> Go to the file you want to download.
> Click it to view the contents within the GitHub UI.
> In the top right, right click the Raw button.
> Save as...
Also does this work for better boob physics that preserve breast volume when the breast bones are simulated?
5.1-mod has been updated again with 5.1 from epic branch.
epic add a Dual Quaternion Skinning Deformer example in 5.1 contentexample,but it does not work for daz character.
Can you take a look at it?
Ok ..so I downloaded it and tried it out and it works on Daz characters you just have to make a deformer graph for it and add the graph in skeletal mesh editor...but there's a problem the dual qaternion deformation breakes the animations and you cannot push the rotation beyond 90 deg (I'm also kind of new to deformer graph so it can be that I messed up somewhere) .. but this brings new hope that we maybe don't need an entire seperate build for DQS to work in unreal...If Alien renders takes a look at this then we are all set and best thing is that alien renders won't have to maintain a forked branch for every release
5.1-mod has been updated again with 5.1 from epic branch.
epic add a Dual Quaternion Skinning Deformer example in 5.1 contentexample,but it does not work for daz character.
Can you take a look at it?
Ok ..so I downloaded it and tried it out and it works on Daz characters you just have to make a deformer graph for it and add the graph in skeletal mesh editor...but there's a problem the dual qaternion deformation breakes the animations and you cannot push the rotation beyond 90 deg (I'm also kind of new to deformer graph so it can be that I messed up somewhere) .. but this brings new hope that we maybe don't need an entire seperate build for DQS to work in unreal...If Alien renders takes a look at this then we are all set and best thing is that alien renders won't have to maintain a forked branch for every release
(Edited by mod to fix quote)
Deformer Graph makes model deformation more customized. I'm trying to change code based on official examples to fix the problem you mentioned.
Deformer Graph makes model deformation more customized. I'm trying to change code based on official examples to fix the problem you mentioned.
sorry for the late reply... yep you're right we just need the code for the custon kernel node in the deformer graph ... if you or anybody manages to figure it out then everyone's years of pain will be relived ... if you do manage to figure it out will you pls share it with everyone here?
Thanks in advace
I took a deep dive into the source code and shaders of the deformer plugin. There's some good news and some bad news.
The good news is that I could probably get this working with a custom shader in a "Custom Compute Kernel". That would mean it could likely be packaged into a plugin.
The bad news is that it would be extremely inefficient. What the "Skeleton" node does right now is execute a shader that reads all the bone matrices that affect ONE vertex (at a time). It outputs all these matrices as Bone Matrix output. It merges them all together according to the bone weights and outputs it as "Weighted Bone Matrix". We can't use this weighted bone matrix as the whole point of using DQS is to have different method of computing the final transform. So I *could* convert each set of bone matrices that affects the vertex. But this would be executed on every vertex. Converting LS matrix to DQS isn't the fastest thing in the world. Doing it over and over on the same matrices would be extremely slow. As a stopgap measure, maybe it would be ok. Dunno.
Just to give a better example of what I mean by inefficient. Say there are 100 bones. And 100K vertices. And you decide to use 8 bone influences per vertex. With the DQS branch, it converts the 100 bone matrices to DQS before sending it to the shaders. Now, it does convert it back, so that's once per vertex. That's 100,100 conversions. I tried avoiding converting back since it just needs to multiply with the vertex position, but I didn't want to mess with the existing shader code.
With the deformer, there would be 800K conversions. These conversions are not simple. And it gets worse for unlimited bone influences.
The deformer graph needs a way to alter or create the bone matrices before it gets to the Skeleton node. Now, if I read the code correctly... since we're writing out the positions, we don't need to convert back.
The irony here is that I could write a deformer graph on the DQS branch to get rid of the back conversions. So 100 conversions on the CPU only, none on the GPU.
I did not find any examples for a DQS deformer graph. The plugin only has linear skinning graphs. Where is the DQS example?
I can try to write a conversion. I only looked briefly at the library that was included with the plugin. You just need to use the "Bone Matrix" and iterate over each converting each to DQS before blending them together according to the weights. There is also no need to convert back as I said.
I think I may have a good solution here. The component that reads the Bone Matrices is the Skeleton node. The code for this is in OptimusDataInterfaceSkeleton.cpp/.h. Doesn't seem too complicated. I wish I could derive from it, but that may be a bit too convoluted. I think I can copy that file and the shader it uses and update it to convert it to a DQS Bone Matrix. I'd have to update the shader code to use the correct DQ multiplication.
Instead of the Skeleton node, you'd use the new one I would build. And in the custom shader, you'd use dual quaternions instead of a LS matrix. I can create all of this.
Then you can just use the deformer wherever you want to use DQS. The nice thing is it avoids back conversions to LS matrices... something even the DQS branch can't do at the moment.
Not sure when I can get to this, but I'm now really interested. I'll try to create something this weekend. No guarantees I'll get it done by then though.
To sum up... if I get this going, it'll be a plugin you enable (as well as the deformer plugin) and you just add the DQS deformer to every skeletal mesh you want to use DQS with.
I'm surprised how difficult it'd be to get Unreal engine perform DQS skin deforming like any other major 3D software, I guess this DQS solution would also work for body physics simulation? Wish to replicate the Skyrim HDT physics with Unreal engine :)
If this is going to be made into a plugin it'd be a nice supplement to JCMs or ML Deformer. I'd purchase it if this is available on the market place.
Really can't thank alienrenders enough for the insights he brings out for everyone.. most of us aren't that capable and he's spending his time fixing everyone's issues
I wish you luck in figuring this out for everyone's sake
but i would like a few answers that came from this method...you said the method is extremely inefficient, then why is epic pushing for the ML and deformer graph so much when they can just put the DQS code in engine it won't be that big of a deal for them right?..so why this approach?
and will this new plugin that you mentioned be performance efficient?..if so how does it compare to the DQS engine brach that you made?
Using the deformer as is with DQS is inefficient. But with LS (and machine learning, etc.), it's fine. It's inefficient with DQS because it has to convert the same matrices from LS to DQS over and over and over again. So instead of once per bone, it does it 8 times per vertex (or more). It's not an order of magnitude slower, it's exponentially slower. But I think I found a way around this.
As for putting DQS directly in the code, it means someone will have to maintain it (like I've been doing on my branch). Also, it would be mixed in with cloth, normal recomputations, etc. in both CPU and GPU code. With the deformer, you can use whichever method you want on the mesh you want. I actually like this deformer plugin. I'm rather surprised it exists at all.
As to how efficient the plugin I'm going to write for DQS will be... if I write it properly, it should be an order of magnitude faster and smaller (both CPU and shaders) than the current DQS branch because there won't be any need to convert back to LS.
Basically, I'm going to write a new Skeleton Node so that there's one conversion from LS to DQS matrices (one per bone). And I'll write a custom compute kernel to apply skinning using DQ math. Now, there are Cloth, morph and recompute normal kernels. I'll do the morph one. It's easy now that they split it up into nodes. I'm not doing the cloth one. Recompute normals I could do, but that'll have to wait.
@catmaster It should work for physics. BTW, where's the JCM deformer?
---
As a sidenote, I'm working in Unreal Engine every day now, so I'm getting much more familiar with it. I'm not going to charge anything for this plugin. If I can get this to be in a plugin, then it means way less maintenance. It also means that on my end, once the plugin is done, I will update the main deformer plugin with my changes in it and do a pull request on the main Epic branch. If it gets approved, it'll be part of the main build in the deformer plugin itself. This has a much higher chance of being approved because there's much less maintenance and it's in a plugin.
This is so interesting a project to me... that it's even possible to do in a plugin, that I've started on it already. I created the plugin framework, copied the skeleton node and the shader into my plugin and am starting to modify the code.
edit: The deformer plugin code has changed a bit since 5.1. When looking at the newest code, I noticed that 5.2 is out. Plugin for 5.1 won't work on 5.2. I'll do 5.1 first I think.
This is so interesting a project to me... that it's even possible to do in a plugin, that I've started on it already. I created the plugin framework, copied the skeleton node and the shader into my plugin and am starting to modify the code.
edit: The deformer plugin code has changed a bit since 5.1. When looking at the newest code, I noticed that 5.2 is out. Plugin for 5.1 won't work on 5.2. I'll do 5.1 first I think.
You're a legend, I wish you nothing but good luck with this. A plugin solution instead of a branch would be game changing for indie devs using Daz characters.
It should work for physics. BTW, where's the JCM deformer?
There's currently no JCM deformer that I'm aware of, I'm using the simple Bone Driven Controller to automatically drive the Daz JCMs which were imported from Blender to UE5 with character mesh, also I've manually sculpt the morph targets to work with Unreal SQS skin deforming. The animations look much better than without using JCMs, but not as good when joints are bent to extreme angles, and this Bone Driven Controller method doesn't work with body physics.
It seems that free plugins in Unreal market place often discontinue support after a while, guess some money is needed to motivate their upgrades with new Unreal versions, it's better to be a paid plugin and Unreal could also buy it and integrate with the official builds.
Comments
When i donwload the unreal engine source from your github it takes 3x more space than same version of the original Epic games store version and also the second problem is when i delete a project that is created from your -mod and i create a new one it still takes up space from my disc(around 1 gb), why does it happen. to download the -mod it took me 60-70 gb and to build the UE4 took me another 60 gb.
I understand you cant make it as a plugin so, Is there a way to merge only the necessery dual quaternion scripts instead of downloading the entire source because it takes way more space than the original Unreal verion, if there is a way can you or anyone here explain what to add and delete? (im talking modifying/adding/deleting scripts from unreal engine 5-mod to unreal engine 5 original)
i tried to remove and add what github showed but it ended up with errors
I would like to second the thoughts in the above post. I've succesfully gotten DQ skinning to work in multiple 4.xx versions of Unreal. However, the folder sizes balloon into these huge, bloated messes.
Why? Why is this necessary? You said yourself that the base default version of Unreal even includes a bit of the things that used to be added by this hack.
I really appreciate and respect all the people involved in modifying Unreal to work better with Daz characters. And I understand that with the big MetaHuman push from Epic they are vanishinly unlikely to officially make it a smooth process to bring in human characters from other software.
But for real, is there any way possible, any way at all, to just edit things under the hood of the usual Unreal install, and thus avoid these bloated doppleganger versions that take forever to download and compile?
Hello AlienRenders,
If you export Genesis 3 Female as FBX and import it into UE5 (your DQS mod) this is how a character's head looks.
Stock UE5 does not have this problem.
Try enabling unlimited bone influences
I'm looking at my UE5 folder and it's 260GB. That's insane. Looks like the branch I cut from had tons of plugins and that's the official 5.0 release. Not sure these are all necessary. There's 70GB in there after it's built. Intermediate folder is 80GB. I think it's building everything. I might take a look this weekend and see if I can update and cut down the build somewhat. I'll prioritize the update first. BTW, it's not my build. I just merged my code changes. The build should be identical to the stock UE5 build. Hopefully, it'll be cut down with the new update.
I do want to try to include on option to switch DQS on or off at some point. Just gotta find the time.
Oh, and I'm thinking of doing a pull request to the official UE5 branch to get at least the math DQ changes added. They're just math functions and don't need to be maintained. I just have to find how they run their unit tests if they have any.
Anyways, the goal of that is that right now changing the math code affects everything. But if it's already in the official build, it would only be one or 2 dll's and some shaders that change to get DQS to work. I could maybe create a patch install for official releases. So you'd install the official release, then the patch and you have DQS. Problem there is forcing the shaders to rebuild but I think I can fix that too.
Also, the more stuff is in the official build, the likelier it is that they would include full DQS eventually.
Once I get the option to turn on/off DQS and fix the morph issues with it, I think I'll try a pull request on the main ue5 branch. The worst that can happen is they say no. If they say yes, then we're all set.
I updated 5.0-mod. To build with your compiler start a x64 native tools command prompt for the VS version you want to use. If you get an error about unrealbuildtool.dll not being built, type this:
set Platform=
Then run GenerateProjectFiles.bat again.
And yes, there's nothing after the equal sign.
I haven't built this one yet. I may only have time this weekend.
that would be amazing, we really need this fix because currently is really hard to work with daz characters in unreal with dq and the new ml deform looks abit bonk currently to be a really viable way.
i have visual studio 2019/2022 and it says i need to use visual studio 2015. still not working
UE5 doesn't build with 2015. So something is out of whack. Working on 5.1 right now.
edit: 5.1-mod should be ready.
I tried looking at disk usage and it's 25GB of source at the start. Then Setup downloads 20GB of dependencies but the UE5 folder grows to 100GB. Then the actual build grows to 205GB. I tried building an install, but it's taking forever as it has to build the developer editor and the game runtime, so it builds everything twice. If I have time later, I'll try building 5.1 without my changes and see what it does.
Another question is when i delete a project in unreal engine build it wont delete the entire space is it a bug or how do i delete the entire project so i can have the same amount of GB as i had before creating it?
Make sure to back up anything you need before doing anything suggested here...
I usually have a C++ UE project in a different folder all together. So when you delete a project, you delete the source folder manually. You can go into the editor and delete it, but that's just to remove it from the list. I haven't removed projects from the editor in ages, sorry.
The thing is these projects would be tiny in comparison if you've just created the basic projects and haven't done much work on it. It sounds like you want to delete a UE build all together. That's a whole different ballgame. Again, you would delete the folder you used for the UE build. I'm afraid I'll need more info on what you're trying to do exactly.
If you mean that you want to start your build over, you can do "clean" in Visual Studio to remove all the object files and dll's. That'll leave you with just the original source (though I don't think it removes everything it built like shaders). Third party dependencies will still be there. So you'll be back to around 100GB. To go below that, you'll need to delete the UE folder and redo git clone. Not sure why you would want to do this if it built correctly.
If you're trying to remove a previous version (like you built 5.1 and don't want 5.0 anymore), then you just delete the 5.0 folder. You may need to upgrade your personal projects to use 5.1. I haven't upgraded local projects yet.
Remember that on Windows, deleted files go in the Trashcan unless it's too big to fit. So to regain the space, don't forget to empty the Trashcan.
I'm updating 5.1 (and 5.1-mod). Looks like I update exactly when the build was broken. I'm seeing a possible fix in the logs, so updating again since my last update earlier. So if you're getting an error generating the project files, try again later. Hopefully, this will be sorted out soon.
Also, I'm going full time into developing my own game. It's not one that requires DAZ characters (for the first game), but hopefully I'll be able to finally finish the option to toggle DQS on/off soon-ish. And I will make a pull request to get at least the quaternion changes added to the main codebase. I just need to figure out where they have their unit tests.
edit: 5.1-mod appears to be updated and working again. I haven't built it yet, but it now generates the project files at least.
I want to delete a project i created with the mod(Not the entire build) a project like third person shooter when i delete my project that is in "Unreal projects" it still going to keep some space.
I had 117 free gb after i built ue 4.26-mod. Then i created a project and imported my daz characters and it went down to 108gb. After I deleted my project(Not build) it went to 115 gb so 2 gb of my project are still hiding somewhere in my PC. How do i delete all my project?
The hidden content probably is within the derived data cache or the vault cache if it's not cleaned from the Epic games launcher.
Need this mod when I replaced the Daz character rig with Epic skeleton and the official bridge JCM morphs post processing becomes invalid.
Found the code repository on the 5.1-mod branch:
https://github.com/AlienRenders/UnrealEngine/blob/e3dcc7161981fe50c2914a5825d1de5cbf94931a/Engine/Shaders/Private/GpuSkinCacheComputeShader.usf
How to download single files from GitHub:
> Go to the file you want to download.
> Click it to view the contents within the GitHub UI.
> In the top right, right click the Raw button.
> Save as...
Also does this work for better boob physics that preserve breast volume when the breast bones are simulated?
5.1-mod has been updated again with 5.1 from epic branch.
epic add a Dual Quaternion Skinning Deformer example in 5.1 contentexample,but it does not work for daz character.
Can you take a look at it?
Ok ..so I downloaded it and tried it out and it works on Daz characters you just have to make a deformer graph for it and add the graph in skeletal mesh editor...but there's a problem the dual qaternion deformation breakes the animations and you cannot push the rotation beyond 90 deg (I'm also kind of new to deformer graph so it can be that I messed up somewhere) .. but this brings new hope that we maybe don't need an entire seperate build for DQS to work in unreal...If Alien renders takes a look at this then we are all set and best thing is that alien renders won't have to maintain a forked branch for every release
(Edited by mod to fix quote)
Deformer Graph makes model deformation more customized. I'm trying to change code based on official examples to fix the problem you mentioned.
sorry for the late reply... yep you're right we just need the code for the custon kernel node in the deformer graph ... if you or anybody manages to figure it out then everyone's years of pain will be relived ... if you do manage to figure it out will you pls share it with everyone here?
Thanks in advace
I'll take a look.
I took a deep dive into the source code and shaders of the deformer plugin. There's some good news and some bad news.
The good news is that I could probably get this working with a custom shader in a "Custom Compute Kernel". That would mean it could likely be packaged into a plugin.
The bad news is that it would be extremely inefficient. What the "Skeleton" node does right now is execute a shader that reads all the bone matrices that affect ONE vertex (at a time). It outputs all these matrices as Bone Matrix output. It merges them all together according to the bone weights and outputs it as "Weighted Bone Matrix". We can't use this weighted bone matrix as the whole point of using DQS is to have different method of computing the final transform. So I *could* convert each set of bone matrices that affects the vertex. But this would be executed on every vertex. Converting LS matrix to DQS isn't the fastest thing in the world. Doing it over and over on the same matrices would be extremely slow. As a stopgap measure, maybe it would be ok. Dunno.
Just to give a better example of what I mean by inefficient. Say there are 100 bones. And 100K vertices. And you decide to use 8 bone influences per vertex. With the DQS branch, it converts the 100 bone matrices to DQS before sending it to the shaders. Now, it does convert it back, so that's once per vertex. That's 100,100 conversions. I tried avoiding converting back since it just needs to multiply with the vertex position, but I didn't want to mess with the existing shader code.
With the deformer, there would be 800K conversions. These conversions are not simple. And it gets worse for unlimited bone influences.
The deformer graph needs a way to alter or create the bone matrices before it gets to the Skeleton node. Now, if I read the code correctly... since we're writing out the positions, we don't need to convert back.
The irony here is that I could write a deformer graph on the DQS branch to get rid of the back conversions. So 100 conversions on the CPU only, none on the GPU.
I did not find any examples for a DQS deformer graph. The plugin only has linear skinning graphs. Where is the DQS example?
I can try to write a conversion. I only looked briefly at the library that was included with the plugin. You just need to use the "Bone Matrix" and iterate over each converting each to DQS before blending them together according to the weights. There is also no need to convert back as I said.
I think I may have a good solution here. The component that reads the Bone Matrices is the Skeleton node. The code for this is in OptimusDataInterfaceSkeleton.cpp/.h. Doesn't seem too complicated. I wish I could derive from it, but that may be a bit too convoluted. I think I can copy that file and the shader it uses and update it to convert it to a DQS Bone Matrix. I'd have to update the shader code to use the correct DQ multiplication.
Instead of the Skeleton node, you'd use the new one I would build. And in the custom shader, you'd use dual quaternions instead of a LS matrix. I can create all of this.
Then you can just use the deformer wherever you want to use DQS. The nice thing is it avoids back conversions to LS matrices... something even the DQS branch can't do at the moment.
Not sure when I can get to this, but I'm now really interested. I'll try to create something this weekend. No guarantees I'll get it done by then though.
To sum up... if I get this going, it'll be a plugin you enable (as well as the deformer plugin) and you just add the DQS deformer to every skeletal mesh you want to use DQS with.
I'm surprised how difficult it'd be to get Unreal engine perform DQS skin deforming like any other major 3D software, I guess this DQS solution would also work for body physics simulation? Wish to replicate the Skyrim HDT physics with Unreal engine :)
If this is going to be made into a plugin it'd be a nice supplement to JCMs or ML Deformer. I'd purchase it if this is available on the market place.
Really can't thank alienrenders enough for the insights he brings out for everyone.. most of us aren't that capable and he's spending his time fixing everyone's issues
I wish you luck in figuring this out for everyone's sake
but i would like a few answers that came from this method...you said the method is extremely inefficient, then why is epic pushing for the ML and deformer graph so much when they can just put the DQS code in engine it won't be that big of a deal for them right?..so why this approach?
and will this new plugin that you mentioned be performance efficient?..if so how does it compare to the DQS engine brach that you made?
Using the deformer as is with DQS is inefficient. But with LS (and machine learning, etc.), it's fine. It's inefficient with DQS because it has to convert the same matrices from LS to DQS over and over and over again. So instead of once per bone, it does it 8 times per vertex (or more). It's not an order of magnitude slower, it's exponentially slower. But I think I found a way around this.
As for putting DQS directly in the code, it means someone will have to maintain it (like I've been doing on my branch). Also, it would be mixed in with cloth, normal recomputations, etc. in both CPU and GPU code. With the deformer, you can use whichever method you want on the mesh you want. I actually like this deformer plugin. I'm rather surprised it exists at all.
As to how efficient the plugin I'm going to write for DQS will be... if I write it properly, it should be an order of magnitude faster and smaller (both CPU and shaders) than the current DQS branch because there won't be any need to convert back to LS.
Basically, I'm going to write a new Skeleton Node so that there's one conversion from LS to DQS matrices (one per bone). And I'll write a custom compute kernel to apply skinning using DQ math. Now, there are Cloth, morph and recompute normal kernels. I'll do the morph one. It's easy now that they split it up into nodes. I'm not doing the cloth one. Recompute normals I could do, but that'll have to wait.
@catmaster It should work for physics. BTW, where's the JCM deformer?
---
As a sidenote, I'm working in Unreal Engine every day now, so I'm getting much more familiar with it. I'm not going to charge anything for this plugin. If I can get this to be in a plugin, then it means way less maintenance. It also means that on my end, once the plugin is done, I will update the main deformer plugin with my changes in it and do a pull request on the main Epic branch. If it gets approved, it'll be part of the main build in the deformer plugin itself. This has a much higher chance of being approved because there's much less maintenance and it's in a plugin.
This is so interesting a project to me... that it's even possible to do in a plugin, that I've started on it already. I created the plugin framework, copied the skeleton node and the shader into my plugin and am starting to modify the code.
edit: The deformer plugin code has changed a bit since 5.1. When looking at the newest code, I noticed that 5.2 is out. Plugin for 5.1 won't work on 5.2. I'll do 5.1 first I think.
You're a legend, I wish you nothing but good luck with this. A plugin solution instead of a branch would be game changing for indie devs using Daz characters.
There's currently no JCM deformer that I'm aware of, I'm using the simple Bone Driven Controller to automatically drive the Daz JCMs which were imported from Blender to UE5 with character mesh, also I've manually sculpt the morph targets to work with Unreal SQS skin deforming. The animations look much better than without using JCMs, but not as good when joints are bent to extreme angles, and this Bone Driven Controller method doesn't work with body physics.
It seems that free plugins in Unreal market place often discontinue support after a while, guess some money is needed to motivate their upgrades with new Unreal versions, it's better to be a paid plugin and Unreal could also buy it and integrate with the official builds.