Skeletal Mesh+Shadow Glitch in UE4

Hi there,
I’ve encountered some strange things with shape keys and skeletal meshes I can’t explain.
I’m using a Dual Quaternion Build of 4.21, but it’s the same, although to a lesser degree in the official 4.22 version as well.

  1. Exported shape keys from blender (2.79) cause strange shadows in UE4, no matter the mesh resolution. At first I thought that my former mesh had a too low quality, but that was not the culprit.
    The shadow doesn’t correspond to the mesh shape. It looks like there were holes in the arms, but there aren’t any holes. It seems to be some kind of lighting problem. It’s at the same location, where the Morph Target has been applied. (removal of armpit bulge)

  2. The arms of a posed character in blender look smoother than in UE4. In UE4 there is a strange distortion (red marking). I can’t explain it, because I don’t even use any modifiers in blender, which could have caused problems with UE4, only the Armature Modifier. It looks as if the bone weights in UE4 and blender differ.


A few questions…
What bones are being translated and what are the translation settings in UE4?
What morph targets are you applying?
Are you using FBX to export from Daz, to Blender, then to UE4, or any other import/export methods?
What models are you using Daz3d? Genesis 8? 3?

The problem is with the normals and morph targets combination. Enabling “recompute tangent” is supposed to fix it (but I don’t think it works)

Also skin cache helps a little, but not completely.

For your first issue, enabling “Force all skinned meshes to recompute tangents” in the project settings definitely works. No idea though whether this specific version with dual quaternion skinning will work with that setting.
For your second issue, I would suspect that the dual quaternion implementation in Blender and your Unreal version could be different causing the distortion.
Just to be sure you can in Blenders weight painting tools use: “Limit Total” with subset “deform pose bones” and a limit of 8 (8 is the max amount unreal can deal with), then “Normalize all” with “deform pose bones” uncheck “lock active” and last use “Quantize” with “deform pose bones” and 255 steps (vertex weights get stored as a byte value as far as I know.)

I was successful in removing the glitchy shadows by enabling “recompute tangent+skin cache (with force all skinned meshes to recompute tangents checked)”. Will do further tests, but it looks good so far with several test poses.
Concerning the distortion issue of the arm I now think too, that it has nothing to do with blender, but with the Dual Quaternion Version of UE4, because there is no arm distortion in blender, even after having limited the weights, doing normalisation, quantisation etc.

@Kednerpo: Do you want to know the bone names and what translation settings info do you need?
The morph targets I’m using are made by me in blender, because I’m using MakeHuman. (a higher resolution mesh) The export from blender to UE4 is done in fbx file format. (armature+mesh export)

@Bronislaw666: Sorry I thought you were working with Daz3D characters. It looked like the same issue I was having with bones not rotating the same way in UE4 as they do in Daz3d Studio causing morph target to not work correctly either.

I just tested your approach, for me it doesn’t work. It reduces incorrect normals in the armpits but it creates incorrect normals somewhere else, on the uv shells border where the arm and the torso uv shells connect. No luck :frowning:

as far as the slight tweak goes, I think your weight painting is either too strong - or - you are accidentally translating those bones in the animation. You should only be affecting Rotations, not Translations as you animate.

I’m using just one 4k skin texture for the the whole body and the shadows look realistic.
But what causes problems, is a mesh distortion at the upper arms, when they are raised.

Which might be caused by bone translation in the original animation.
Read as - It looks like you dislocated his shoulder bones, are you sure they are where they need to be?

The animation is correct (have even reset the rotation of the bottom bone of the upper arm where the distortion is and in blender it looks smooth, but on import into UE there are distortions.
I’ve limited the bone influences to 8, set smoothing to face in blender and even without showing any warnings the mesh does look worse in UE than in blender.
Is it possible that UE is truncating some bone influences on import in the background without even giving a warning about it or is it some rounding issue? I’ve got a high resolution mesh and need precise bone weight values for most realistic look of my character.
And if it is a problem with some shader calculations / rounding of values, where in the source code can I find that part and hopefully correct it?

I think the issue might be just the retargeting again (it’s fairly common).
are you leaving the skeleton empty when importing? Give that a try…

It still doesn’t change a thing. It seems as if blender takes smaller weights into consideration than UE4 (even without any warning about this in UE), esp. where the bones meet.
You can follow the discussion here for more background infos: Adding Dual Quaternion support to UnrealEngine4 (Images inside) - Page 5 - Daz 3D Forums

What happens if you pose the mesh in blender and export only the mesh?

Also, I have literally rewritten half the FBX exporter. The issue is not on the blender end or the import to unreal end.
The armatures and meshes behave like expected (comparable to maya and 3dsmax, which is exactly as drawn.

The things that affect a character animation import are the retargeting and improper setup of bone rotations as well as bad export settings.

Maybe you could film your import/export process so we can review it and try to catch the issue.

Another thing you may want to check is that your shoulder bones aren’t rotating 360 deg around in this animation compared to where they are suppose to be.
reset the pose with alt g, alt s, alt r, and move the hands up again to see if you notice any changes.

Yuo could even just animate the arms going all the way up to spot when (at what rotation angle approximately) the issue starts to occurs.

Also, remember your kinetic chain. When you lift arms up the shoulder and clavicle adjust with it. If they don’t you end up stretching and deforming the mesh rather then having a natural look. This may be part of your proble too. (The adjustment on the clavicle is very slight usually, so maybe there’s even more to the issue).

If I export only the posed mesh without armature, it looks smoother (as expected) than the posed mesh with armature.

I can describe what I’m doing exactly to reproduce the problem.

I’ve got a skeletal mesh, which has been exported / imported with the following settings:

Skeletal Mesh in Blender and UE4:

This is with the UE 4.22.3 Version. In the Dual Quaternion Version from the DAZ site (link given above) the distortion is even more pronounced / worse.
As for the rotation angles ue should deliver the same results as blender no matter how extreme the bone rotations may be.
Normally I’m using the Dual Quaternion Version + Corrective Shape keys for the armpits, so some poses may look wrong without preserve volume checked, but look good with preserve volume + shape key.

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.

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
Blender:

UE4:

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:

and

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

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)?