No announcement yet.

Skeletal Mesh+Shadow Glitch in UE4

  • Filter
  • Time
  • Show
Clear All
new posts

    Disable leaf bones in the export.
    Check the apply all modifiers on the main tab.
    Change smoothing to faces only (to see if you get any differences).

    Export only a base pose in A or T pose to get a master skeleton going with the proper mesh.

    import in unreal - I would reset all the settings just to be sure first. Disable the animation when taking in just the master pose.
    this will create the mesh, the skeleton, and optionally the materials.

    Secondly, export the "raising arms" animation without the mesh.
    select only the armature in blender, export the FBX
    Check the only selected box during export and tweak the values as above.

    When you import into ue4 now, you will just be taking in the bones.
    Select the previous skeletal mesh during import.

    Play the animation and check to see if you are still seeing the issue.
    hopefully you won't.

    If you still see the issue I would suggest getting rid of the shape keys first in the master pose, import in a fresh one after deleting the skeleton/mesh, and repeating the steps.
    try and isolate if the issue stems from the mesh or from the shape key associated with the mesh.
    afterall one of your edge loops is bulging out. Something is causing this, and it can't be the bone rotation or everyone would be complaining about issues.

    Oh and within blender - what type of bones are you actually using?
    normally you would use the octahedral or whatever the ones that look like cones are.
    you can change the display to sticks, like you seem to be doing, but you could also be using bendy bones, which aren't going to work in UE4.
    Last edited by MostHost LA; 07-20-2019, 04:59 PM.


      Still no success (same result) and for this test I didn't use any shape keys or modifiers beyond the armature. Maybe I can provide the .blend file and you could see it for yourself. But where to upload it?


        Sent you a PM.


          With the file you provided, I can actually see the bend in the arm when the animation is set downwards.

          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


          It's definitely accentuated in UE4. this may be in part because it is triangulated vs the current version which is not triangulated.

          Triangulating in blender and applying the triangulate modifier does lessen the spike:


          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

          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

          Also, just noticed that using the Flatten option from the loop tools seems to do exactly what you need to fix that loop section

          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.


            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.


              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.


                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:
                Last edited by Bronislaw666; 07-23-2019, 04:38 PM.


                  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?"
                  "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...


                    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:


                    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?

                    Last edited by Bronislaw666; 07-24-2019, 02:28 PM.


                      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...


                        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:


                        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.


                          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.


                            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.


                              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.

                              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...


                                [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.