Announcement

Collapse
No announcement yet.

Skeletal Mesh+Shadow Glitch in UE4

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    I will definitively look into rigify someday, but for now I will have to stick to the makehuman default rig, because the current workflow MakeHuman->Blender->UE4 guarantees constant output quality with creating a broad range of characters, without additional bone rearrangement or weight painting work.

    Leave a comment:


  • replied
    Originally posted by Bronislaw666 View Post
    [SOLVED by setting Minweight to 0.005f]

    But why does it happen with the standard t pose too? And why isn't blender showing this behavior as well?
    For the Tpose it's the same reason as described above.
    as for the "why isn't blender" part: mostly because the values in blender aren't truncated.
    assuming they were only when below .001 you would probably see the same result.

    Also, As I was re-thinking about this:
    If you eliminate the 2 bones on the shoulder and make a proper anatomical rig for your meshes you would very likely eliminate the distorsion - Given the distortion is generated by truncating the value on only one bone you have a 50% of eliminating the right bone and not seeing the distortion even with the stock engine.

    You know you can generate the correct right with Rigify in blender right? You actually don't have to overwork the armature to get it just perfect...
    Last edited by MostHost LA; 07-27-2019, 06:05 AM.

    Leave a comment:


  • replied
    [SOLVED by setting Minweight to 0.005f]

    But why does it happen with the standard t pose too? And why isn't blender showing this behavior as well?

    The mesh is intended for use with the dual quaternion version, so this unoptimized mesh strangely looks and behaves much better in the DQ version than in the normal version.

    But I will definitively look into it sometime in the near future and try out some optimizations.

    Meshes, which have optimized topology for simple linear skinning tend to behave worse in the DQ version than "my" modified mesh. (have tried out every character creation tool out there and decided to go for MakeHuman+own weight paint mod+subdivision+morph target for armpits/upper arms.

    I've seen meshes from Character Creator 3, MBLab or DAZ and they have a nice topology, but don't behave as nicely as my modified mh mesh version+they have other issues.

    CC3 is more optimized for linear skinning, while DAZ needs many morph targets to behave correctly and MBLab is still experimental and not optimized for gamedev as well.

    The MH default rig has many bones, because it gives more control and it has been made for linear skinning. It's always better to have more bones for better rig control. If you don't touch them, they will not bother you.

    As we have limited resources, not everything can be simulated perfectly and I'm still waiting to witness one perfect universal "out of the box" rig for many different randomly generated characters, which is suited well for use in a game engine.

    As for reweighting: I know it's fairly simple and blender has even the option to truncate values below a certain threshold, but that is still causing an uneven skin with different animations. Therefore the need for changing the minweight to a lower value.

    I've set the value now to 0.005f at it seems to work at first glance :-)
    And compiling time is only bad if you do it for the first time, but than it is just a matter of seconds. I guess it is a feature of the new VS Studio 2019.
    Last edited by Bronislaw666; 07-26-2019, 03:20 AM.

    Leave a comment:


  • replied
    Yes but that's not "random" its occurring because the value close to 0 is no longer being removed.
    so you have a few verticis that are probably weighted on different bones.

    dropping the weight when the value is near 0 (at .01) prevents the 2 interference or the 2 weights values.
    not dropping said value causes a spike on those vertices that slightly exceed and therefore intersect.

    Also,
    You can't expect someone else's skinned mesh to work fine while pushing the limits.

    To push the limits you actually need to create perfect assets with all the needed bits, pieces, and most importantly LOD levels.

    Within the FBX you shared for instance, the whole elbow bend looks like a noodle. That's definitely not anatomically accurate to the start with - unless you are actually mr fantastic or Gumby...

    If you search you can find some perfect anatomical scans for both female and Male bodies that are actual scientific work, complete of underlying musculature, organs and bones. Ideally (though the last file I opened was close to 1gb) you could start off from the skin of one of those files and already get a better result. (Licensing wise would have to probably pay to use in the end product, but its usually provided free to study)

    While we are on the subject of realism, how many bones do you have between the elbow and your shoulder?
    What about lenghtwise between elbow and wrist?
    Therein lies your second issue.
    probably also why the elbow is bent like rubber.

    To achieve realism you have to emulate an actual skeletal structure as much as possible.
    That means 1 bone between articulations, and some times an optional parallel one for limiting or twisting (radiai and tibia, forearm and shin area)

    Also, It's actually simple enough to re-weight paint the whole armor loop by loop to have all values above .01 when you have to do the whole armor anyway.
    What isn't simple is spotting which of the vertices you are having problems with and what bones they are responding to when you utilize the automatic weights from blender as a basis...

    Leave a comment:


  • replied
    It's not about what me or any other player might or might not be able to see, but about immersion. It has to look as realistic as humanely possible under any circumstances, even if the body mesh is hidden behind multiple layers of clothing. :-)
    We have to push the limits of what's possible today and not being satisfied with the current state! And I'm on a good path in accomplishing this.

    The question is only how to achieve a smooth and perfect skeletal mesh, which deforms well. One possibility is to change the topology in makehuman (very difficult and time consuming; will be the next step), another way is to change how UE is handling the skeletal mesh import. (minweight)

    Before I change the minweight (again) to a different value I would like to know what causes my issues with the mesh regarding the current already changed state (minweight 0.001f instead of 0.01f), because building the source and all the shaders takes a very long time probably only to find out that it didn't work out as expected.

    I've looked into the source (everything with import or fbx import of skeletal meshes .cpp), but everything looks unsuspicious, clean and seems to be organized well and I didn't see any obvious errors in the variables of the cpp files concerned, but I don't know because I didn't code it and thus have no deeper understanding of the underlying concept and the interdependencies the files are based on. Maybe I have to change another variables for it to work, but which one?

    Here an example screen of the new random distortion problem (mesh has even some holes). But the old weight issue went away.
    Maybe some of the UE developers could give me a hint on where to look in the code?

    Click image for larger version  Name:	minweight_0p001f.jpg Views:	1 Size:	164.1 KB ID:	1646390
    Last edited by Bronislaw666; 07-25-2019, 01:21 PM.

    Leave a comment:


  • replied
    You are focusing on the wrong thing. In a tfps game you will never be able to spot the skin being uneven by your bicep.
    In fact you'll be hard pressed to even see your bicep.
    In third person with movement you'll never be close enough to spot even the original kink.

    That said, you could try .005 as a cut off and see if it makes any difference.

    but remember that unless you give the player the possibility to move the viewport camera around like in editor, they will literally never be able to spot this.

    Leave a comment:


  • replied
    I've changed the source code and the old problem went away, but now there is something strange happening: The newly imported characters have many randomly distorted parts all over the body:

    https://forums.unrealengine.com/deve...mport-question

    Only the newly imported skeletal meshes have this, not the old ones (from before the source code change), so it has something to do with the import and the changed source code. Some hidden inter-dependencies?



    Here is what I did:
    In Engine/Source/Editor/UnrealEd/Private/Factories/SkeletalMeshImport.cpp I changed const float MINWEIGHT = 0.01f, to const float MINWEIGHT = 0.001f;




    You're right that I should change the topology, but it's not that simple and I need characters with even skin. Smooth/even skin with a broad range of animations is only possible with precise weight painting. (I need a close up view of the characters all the time for super realism in my FPS/TPS kind of game)

    I'm using MakeHuman and have established a fast reliable workflow for bringing different characters from MH over Blender to UE4 and I need a reliable topology quality and can't afford to change and fine-tune everything manually with different and unreliable results.

    The best way would be to change the topology in makehuman directly, but I don't know how difficult it is or if it is that simple (vertex count/order, compatibility with targets and clothes).

    The mesh subdivision is a temp (it comes at a cost of around 137k tris for a "naked" character mesh) and fast solution to overcome the need for a "next gen" topology while keeping a fast workflow and mostly a fairly realistic result (and it's only being used for the highest level of detail, so no big deal if you use it only for a few main characters on the scene). UE4 has a LOD creation feature, that works very well for the most part (and I can still import my own lods from blender).

    In short/medium term something will have to be done about the outdated topology of the makehuman characters for achieving better deforming bodies "out of the box", which don't need too many vertices/tris and are optimized for Dual Quaternion Skinning.
    With the current topology even weight painting has its limits and the bone influence distribution isn't optimized as well. But it's very difficult to make a new topology if you don't have real knowledge about anatomy and realistic deformations.
    Last edited by Bronislaw666; 07-25-2019, 07:53 AM.

    Leave a comment:


  • replied
    Probably not.

    but if you think that's the issue, why not repaint the whole mesh section to a minimum of .02 and try to see if the issue exists even when the blend weight is higher then .01 ?

    just so you know, I had the exact same distortion within blender without triangulating - and even painting it to a weight of 1 did nothing at all to correct it.
    hence why it's the loop edge within the mesh that is problematic.

    Also why retopologizing the mesh section corrected the issue as shown in the screenshots.

    If you really want to try you can always modify the CPP file and build the custom engine, though I'm not sure its worth the effort...

    Leave a comment:


  • replied
    Most people don't complain, because they use clothed characters mostly (pullovers and jeans are uneven by their nature) or they don't look closer (close up view) or they use low poly / cartoony meshes (where it doesn't matter, thus they don't realize the unevenness of the skin.

    But some people have the same problem like me:

    https://answers.unrealengine.com/que...from-maya.html
    https://answers.unrealengine.com/que...8236/view.html
    https://answers.unrealengine.com/que...x-weights.html
    https://www.deviantart.com/comments/...48322/18594656

    I've got even the same leg distortion with my mesh like the guy from one of the questions from the links and he definitively used a different body mesh than me.
    Let's do a simple test and compare a static mesh and a skeletal mesh with the same pose, which have been imported to UE4 from blender:
    Normally both should be identical, but what do we see:

    Click image for larger version  Name:	static-vs-skeletal.jpg Views:	1 Size:	418.5 KB ID:	1645881

    Static Mesh: turquise
    Skeletal Mesh: yellow

    They are not identical and only the skeletal mesh is distorted.
    Therefore it must have something to do with the fact that UE is treating skeletal meshes differently than static meshes on import of fbx files.

    The static mesh looks how I would expect it to be and how it exactly looks in blender.

    I'm sure this is a bone weight truncating issue and has nothing to do with topology of my very high poly mesh, where no topology should matter, because the triangles are really small.
    But the problem occurs even with low poly meshes.

    The question now is:
    What line in the source code to change for reducing the truncation effect to a lower value? I think the value is now something like 0.01.
    If you apply the "cleaning" option in blender and set it to this value you can get the same effect.

    P.S.: I think I've found something promising, but can anyone confirm that this will work as expected?

    https://forums.unrealengine.com/deve...mport-question
    Last edited by Bronislaw666; 07-24-2019, 02:28 PM.

    Leave a comment:


  • replied
    Ue4 is not truncating any weights. Can you imagine the amount of complaints that you would see here in the forums if that was the case?
    Neither is blender. The data is written to the FBX as is.

    As I showed in my screenshots the view in blender is far from perfect. It shows the very same kink present throughout.

    You can delete the edge loops in question and re-extrude if you want to be sure about the assigned weights.
    then just bridge the last 2 edge loops together and re-weight paint the section manually.

    Other then that, there is nothing else that can be the "cause" of this.

    The best questions one can make are:
    "where did the original mesh come from?"
    "did you modify and adjust the problem area?"
    And
    "Can you use a different mesh that actually works as a starting basis to model upon?"

    If the first answer is I made it from scratch, then the assumption is you made it wrong. It happens.

    If you got it from somewhere else, they made it wrong. It happens too.

    If you got it from somewhere else and modified the arms, that's probably when the loop was altered.

    The last question is just for you to answer.
    if that's an option, start from scratch and test the arms being raised before changing anything at all.
    that will tell you immediately if the mesh is fine or not.

    As a side note. Body meshes are generally mirrored and X dominant.
    given you are working on the left hand only I would assume the right hand has the very same issue and was the part that was originally modeled if you downloaded a starting mesh from somewhere.

    My 2 cents, delete the edge loops. There is no way you need more then 10 in an arm section when you do things anatomically / properly.
    unless your intention is to sculpt the normals, in which case what you have needs to be subdivided another 200 times or so and sculpted with pitting for the skin...

    Leave a comment:


  • replied
    I've tried triangulating (the high poly version of my mesh and a low poly one) and it had no effect at all. The same goes for the flatten and the relax function of the loop tools /moving some vertrices manually, even triangulating and loop tools together did nothing.

    In my opinion the topology does not cause this, because the small imperfections of the edge loops can't have this huge effect.
    In blender everything looks perfect and its not some magic smoothing effect, since it looks fine in wire frame mode as well.

    It has to be something with the weights in UE only. But changing the weights in blender is a complete guessing game, when it looks differently in UE.

    Is there a way to look into single NUMERIC vertex weights in ue / blender and compare them in order to check if UE is dropping any weights where it shouldn't?
    Another user appeared to have had similar problems some time ago: https://answers.unrealengine.com/que...x-weights.html
    Last edited by Bronislaw666; 07-23-2019, 04:38 PM.

    Leave a comment:


  • replied
    Essentially its because the mesh gets triangulated on import.
    if you triangulate the mesh within blender you can see the same effect happen in blender (2.8) to a lesser degree.
    The lesser degree comes down to the shadowing/render engine.

    the best suggestion I have is to triangulate the mesh with a triangulate modifier so that it's not done by the engine import, but by the FBX export (when you click apply modifiers checkbox).

    If you give it a couple of days we should get a stable 2.8 release. That will probably help some as you'll be able to use my plugin for exporting/importing and it simplifies your life a little bit.

    Regarding the flatten. You need to work it loop by loop.
    it basically makes the loop flat by mathematically averaging whatever size it needs to.
    yes, an arm isn't flat per-se. But you can flatten the 3 or 4 loops around the problem area and with the all selected you can rotate them back to being in line with the rest of the mesh.
    it will remove the twitch you have in there.

    Leave a comment:


  • replied
    Many thanks for your detailed answer.
    I've made some first tests with triangulation in blender and it's still the same bad result.
    I'm using blender 2.79 and the FBX 7.4 binary option. Maybe this is the culprit?

    As for the Flatten function, I'm not sure if it will not distort other parts of the mesh like the armpits, so it would only move the problem to another part of the mesh.

    Concerning repainting the weights: How can I repaint the weights, when blender is showing everything in a perfect state and smooth while it looks glitchy in UE.
    What I'm not understanding is why the mesh in ue4 is different from the mesh in blender? Is it a UE specific issue?

    In my opinion something bad happens during import to ue4 (rounding error of vertex weights / precision issue), because opening the same fbx file in blender after
    export is showing no problems with the mesh (beyond some bone issues, which don't affect the mesh directly if you don't change anything)
    Is it possible to look up single vertex weights in ue (as numbers, not colors)?
    Last edited by Bronislaw666; 07-22-2019, 08:52 AM.

    Leave a comment:


  • replied
    With the file you provided, I can actually see the bend in the arm when the animation is set downwards.
    https://gyazo.com/4f97b7f27def4cb6ba3a6a14e28d3e46

    The issue stems form a combination of weight paint, bad edge-loop and triangulation.

    This is the same loop that you see doing this In UE4
    Blender:
    https://gyazo.com/819d4db477e309d6fee1110a57c17d95
    UE4:
    https://gyazo.com/a26bba25acbd8d944664c1b17e1d9105

    It's definitely accentuated in UE4. this may be in part because it is triangulated vs the current version which is not triangulated.
    https://docs.unrealengine.com/en-US/...hes/index.html

    Triangulating in blender and applying the triangulate modifier does lessen the spike:
    https://gyazo.com/08f40a1c05e8b43e1678a18917c6f9fe
    and
    https://gyazo.com/44b06db263536e9049eef22c56e57a4a

    Note that I also messed with the weight paint, but you shouldn't have to do too much with that. it's basically coming down to bad geometry.

    I would suggest going back to the T pose, taking the edge loops in section and using the LoopTools addon to get the spacing between the edgeloops to be identical before triangulating.
    You can see that adjusting the spacing with the Space function on just one edge loop throws things off
    https://gyazo.com/a15cdedf7f7fcb2ead49f1f6031015d9
    Ideally it should get to where things no longer move around - or you can bypass that, triangulate, and adjust the triangle edge...

    You also have other issues with your geometry though
    https://gyazo.com/50efc99ec6b2f99d23f47af1c1340357

    Also, just noticed that using the Flatten option from the loop tools seems to do exactly what you need to fix that loop section
    https://gyazo.com/7e8bd0fb98e8404fcea4b7c7cfedf7be
    It does create other issues (the underarm though is not the issue, it's because I messed with the weight paint).
    Last edited by MostHost LA; 07-21-2019, 11:40 PM.

    Leave a comment:


  • replied
    Sent you a PM.

    Leave a comment:

Working...
X