Apex cloth, 1 bone works but 2+ doesn't

I’m using 4.9.2 and Blender version 2.76b. I’m exporting an .fbx file and opening it in the standalone ClothingToolCHECKED.exe (physx ver. 3.3), and from there compute the tangents and save as an .apx file.

Using one bone it works fine, but as soon as you use two or more bones you get the following error when importing the .apx file in UE4.

71600-clotherror.png

This error is a bit strange since according to the code the bone that failed will be printed as a string, but nothing is getting printed which makes it unclear if there was a bone that failed or not.

The interesting apex code starts from line 753 in ApexClothingUtils.cpp (https://github.com/EpicGames/UnrealEngine/blob/a27ad66f0a075f3b74ef8f68a4b2b0da4882425e/Engine/Source/Editor/UnrealEd/Private/ApexClothingUtils.cpp#L753), the bone mapping code starts at line 804. I don’t see why two bones can’t work if one bone works.

I’ve got some theories as to why this happens. The first is that Blender outputs an armature object as the “empty” object for the rig which in both UE4 and the Apex standalone tool turns into a separate bone (which I’m not sure if it should or not). This means that my 1 bone fbx actually is 2 bones, the 2 bone fbx is 3 and so on. Maybe this causes some issues. I know for example that you have to animate the armature object in Blender in order to use root motion in UE4.

Next, opening the .apx you can see that the boneCount variable says “1” in the 1 bone .fbx but “3” in the 2 bone .fbx, which to me seems really strange. I tried manually setting it to “2” but it didn’t help.

It would be nice to be able to use a combination of blender, the apex cloth standalone tool and UE4 so I hope this can be resolved (if it is in fact a UE4 bug). I’m attaching the .fbx files and .apx files. [Zip file here][2]

Hi cyaoeu,

I was able to confirm what you’re seeing and have reported this with UE-24991. I’m not sure if this is a bug with UE4 or if this is something on Blenders end. Once a developer has investigated this and I can update with any relevant information here.

Thank you for reporting and including very detailed information!

Tim

Is there any news on that problem? I’ve exactly the same problem and have been trying everything I could think of to make it work without success. Any answer would be greatly appreciated!

Unfortunately, there is not update at this time regarding UE-24991.

I was suffering from the same message.
but I resolved it.

The cause of this error is Boneweight datatype.

UE importer accepts .apxfile that has float1 or float4 boneweight.
float2 or float3 boneweight causes this error.

This datatype depends on the vertex affected by a largest number of bones .
When a cloth mesh has at least one vertex affected by 4 or more bones ,datatype will be float4,work fine.
only 2 bone-affected vertex ,float2.

check .apxfile/graphicalLods/submeshes/vertexBuffer

Nice catch! Sure enough it seems to work with 4 bones. Now I feel sad that I didn’t test with 4 bones but just with 1, 2 and 3. :stuck_out_tongue:

User 0000 found out that something was going on with float1 vs float4 since Apex seems to work with 1 bone and 4 bones (with at least one vertex actually weighted to all 4 bones). Actually the number of bones doesn’t matter at all, what matters is how many bones the vertices are weighted to.

So Apex in UE4 with files made in the stand alone clothing tool seems to work with meshes with vertices weighted to one bone, or more than four bones.

I made some new .fbx and .apx files. New apex tests

5boneapex ver1.fbx (and .apx) has five bones and a mesh weighted to only one bone. Works.

5boneapex ver2.fbx has five bones and a mesh weighted to 2-3 bones. Doesn’t work.

5boneapex ver3.apx has five bones and a mesh weighted to 2-3 bones except one vertex weighted to five bones. Works.

When looking through the .apx file numBonesPerVertex is 4 even though the mesh technically has a vertex weighted to 5 bones so it seems 4 is the maximum. A mesh with 6 bones also gave numBonesPerVertex 4.

numBonesPerVertex (or boneweight and float1 vs float4 like 0000 said) seems to be the issue. This should hopefully make solving the issue a bit easier.

I don’t think numBonesPerVertex matters. numBonesPerVertex in physicalMeshes, but UE loads submeshes in graphicalLods.

For example, when submesh1(coat) is weighted to 5 bones and submesh2(tie) is weighted to 2 bones , numBonesPerVertex is 4.
But the coat works,the tie doesn’t.

The array buffers in submeshes is the actual data used by UE.
And the type of boneweight in the buffer matters.

A small update: Editing the FBX exporter in Blender to not add an additional bone for the armature modifier (Prevent Blender FBX Exporter adding extra root bone – Kris Redbeard) seems to fix this issue. I was able to add a mesh with several bones and still have APEX work.