daz3d / DazToUnreal

Daz to Unreal Bridge
Apache License 2.0
154 stars 46 forks source link

UE Morph Targets import limit and re-import crash #50

Open IamTirion opened 1 year ago

IamTirion commented 1 year ago

Hello, I have encountered two problems. The first problem is when I have a Daz character such as G8.1M in Unreal Engine, and then I send the same characater to Unreal again to update it, to add more morphs, it crashes Unreal Engine every time for me.

The second problem is Unreal Engine only allows 100 Morph Targets to be imported every time. To add more, you have to import the same character with different morphs a second time, which is how I encountered the first problem. It is impossible to send a character with all the morphs you selected in the bridge plugin in one go if they exceed 100.

Is there a workaround for this currently? Thank you.

danielbui78 commented 1 year ago
  1. Regarding Unreal Engine re-import crashes, I was able to identify a crash related to a complex interaction between DazToUnreal, Unreal Engine's SkeletalMesh importer, and Unreal Engine's IKRig module. Specifically, an incorrect assumption is made by the IKRig module that the number of bones in a re-imported skeletalmesh will never change, and thus a C++ assertion is failed during the skeletalmesh import, when an event cascade initiates all poses (including IKRig retargeted poses) to be re-evaluated. A proper solution will probably require submitting a patch to the Unreal Engine source code, so for now, I have implemented a crash-protection check which will gracefully handle the error condition before the assertion is failed and the Unreal Editor crashes to desktop.

  2. Regarding the problem that Unreal Engine only allows 100 Morph Targets to be imported at a time, I am unable to reproduce this behavior. I have successfully exported a Daz character with over 3.900 morph targets and I have manually counted up to 500 of them to satisfy myself that they have correctly transferred. Please include more detail, screenshots and recorded screen capture of this 100 morph target limit so that I can better understand the problem you are experiencing. I have read through Unreal Engine's FbxImporter implementation and do not see anything which would limit it to 100 morph targets. There does appear to be an inherent limitation in the number of blendshapes by the int32 data type that stores the number, but this provides a theoretical maximum of about 2 billion blendshapes.

  3. Regarding the ability for Unreal Engine to "add more morphs" to a skeletal mesh by re-importing an updated fbx file, I am unable to find any documentation, tutorial or source code file that suggests that such a behavior is built into Unreal Engine. It might be possible to do with a third-party add-on to Unreal Engine that can edit morphs, but I do not think the Unreal Engine can do this on its own. Please provide any documentation that you have about this feature existing. Thanks.

danielbui78 commented 1 year ago

Re-Import Crash-protection is already live in the main branch. Compiled binaries for PC/Mac on Unreal Engines 4.25 - 5.2 will be uploaded to Github later today and plan to upload to DIM within the next several days.

IamTirion commented 1 year ago

About point 2 and 3, it seems to be a misunderstanding on my end. There isn't any official documentation on this matter, but according to some posts on the Unreal Engine forums, the limit on morph targets was 100 per import, and the way to get more than that is to import the same mesh with different morph targets.

https://forums.unrealengine.com/t/unreal-4-how-do-you-import-additional-morph-targets-to-a-mesh-already-imported-to-ue/107306/5 https://forums.unrealengine.com/t/how-to-get-more-than-100-morph-targets/355994

But apparently that has been changed a long time ago. I thought I had this problem because some of the morphs I selected in Daz did not get transferred to UE5. But I later found out it was because they were morphs on a geograft and transferring them requires additional actions. Sorry that I didn't tell you this earlier, and thank you for looking into this.