APEX cloth ruins normals


I’ve been stuck on the following issue since a few days:

I have this beautifully looking mesh (normals wise, let’s not start a discussion about my modelling skills - or lack thereof :stuck_out_tongue: ) :

Since skirts are hard to animate, and since I’m quite new to Unreal Engine and this project is meant to try out as many things as possible, I decided to give it some APEX cloth simulation. However, while the cloth simulation itself works fine, it completely messes up the normals/tangents/wathever is used for lighting, making it look like this:

When I make the material unshaded, everything still looks correct, so the normals seem to be the only thing that’s messed up.
I’ve tried it both with an fbx exported from Blender, with clothing created in nvidia’s tool that comes with the APEX SDK (while using various fbx exporter scripts with many different options), and I also tried importing the file in Maya and creating the clothing with the APEX Maya plugin, but unfortunately I haven’t been able to find a combination of tools and settings that does not mess up the normals.

I’ve inspected the normals of the mesh, and they seemed fine. I’ve also tried automatically recalculating the normals, again: same result. I’ve also tried negating all normals in the .apx file, but this didn’t seem to do anything.

Is there a way to fix the APEX file’s normals, or a working tool that correctly creates them, or a way to make unreal engine simply use the perfectly fine normals of the model itself instead of the corrupted ones from the APEX file?

Many thanks in advance.

have you tried re-calc the normals in apex, i show this in my latest blender apex video

Do you mean clicking the generate tangents / update tangents button? I’ve done that, yes. If I don’t click that button before exporting, not only the normals but the entire texture is messed up. If you mean something else, could you then please provide a link to the video you mean? Because then I haven’t been able to find it.

I managed to find a fix: Apparently, the APEX SDK doesn’t like overlapping UVs, or UV-coordinate seams in the parts that are simulated. So in order to fix this, I had to unwrap the UV’s again, and make sure to not create any seams in neither the skirt nor the hair, then bake the texture to the new UV-map, the process to do this is explained in this stackexchange answer:

This now makes my model look like this:

However, this still isn’t an ideal solution, because no seams in such a large and curved area create a lot of distortion, so I had to double the texture’s size (which significantly increases the memory usage), and the result is still blurrier than the original, so if anyone has a better solution, that would still be greatly appreciated.
I still consider it usable though.

ok this is the video i meant , but looks like you fixed it, sorry but it’s sort of general knowledge that afaik any apex cloth needs to have a seperate texture/material , i admit i’ve only done basic flag waving stuff,

as for the uv map thats a standard requirement for all game content, or have i miss understould your last post !!

it might help if you give more info on texture map size what sort of maps your using etc.

also you do realise that to get decent effects from apex cloth you need a lot of polygons, your model has ca 2500 whick likely quite a few for the hands , you might need more for the skirt to work better

What I meant with the seams is this:

Here is a comparisant of the old vs new textures:

In the old texture, the entire mesh is split in half and the left side uses the same UV’s as the right side, but mirrored (because the left and right sides look the same anyway, and this gives me twice as much pixels for the same texture size). Because of how simple this drawing style is, it’s not that easy to see, but the mesh is split up in a lot of different parts to both minimize the distortion and fill the texture as efficient as possible. This was mainly done with the automatic unwrapping script, with some manual tweaks.
For the new texture/UV map, I first needed to get rid of all overlapping UVs, since the APEX tool doesn’t seem to be able to handle that, then I also had to get rid of any seams in simulated areas, because the APEX tool doesn’t seem to like that either (I tried several UV layouts, to find out what worked and what didn’t). Because a skirt is nearly cylindrical, to unwrap it without a seam, it deforms a lot, and it stretches out to that big circular lollipop shape you see at the bottom right.
I also tried using 2 UV layouts, hoping that the APEX tool would base it’s normals calculations on the one that meets the requirements (for which I also tried changing the order of the UV layers), while I could let Unreal engine use the other UV layer for rendering. This unfortunately didn’t work either, and it still caused messed-up normals (why the APEX SDK even depends on UV-maps to generate the normals is a mystery to me though). Using multiple material slots to only let the simulated parts using the clothing material also gave me a lot of problems, like completely messing up UVs, making vertices disappear and sometimes those files couldn’t even be imported due to a ‘missing bones’ error. So eventually I just gave up on that and made the mesh use only 1 material slot instead.

As for the polygon count: this is indeed one of the most low-res models of my game, and because of it, I needed quite a bit of tweaking to make the skirt not clip trough the legs, but with that done, I’m quite glad at how it looks. It doesn’t work well for all animations, but it’s an NPC model and it works fine for the animations that will be used on it.

By the way, your video is the one I used to find out how to actually use the APEX SDK and how to get the simulation itself to work. Without it, I probably wouldn’t have gotten anywhere, so thanks for that :wink: .