Flickering Mesh Sections ??

So, I wrote an algorithm that takes a USkeletalMesh and divides its LODModel[0] into seperated sections by analyzing connections of triangles and identifying isolated “nets” to split off into new sections.

When I’m done with the modifications, I call Mesh->PostEditChange() to update the render data.

I ran this on a character mesh, 3 sections became 42, and everything appears to work fine, except I get extreme flickering for 2 of the sections and I have no idea why. 40 out of 42 sections are ok, only the 2nd and 5th section are flickering.

Any ideas what could be the source of this problem? I double checked if all the vertex and index data adds up, and I have no idea what to look for now.

… It can’t be z-fighting, because the 2 sections are very rapidly switching between solid and invisible - there’s no other material on top of them. The section shadows flicker the same way. I don’t think it can be bounds-related either, because I’m not aware of any per-section bounds.

The flickering is not related to camera movement and sometimes it just stops when I press random buttons in the editor’s mesh viewer, but it always comes back.

Anyone?..

I randomized the order/sorting of the sections and it turns out that it’s the same 2 sections that still flicker - not the same section indices, but the same body part at the random index. So, I guess it’s relatively safe to assume that the problem is with the section data somehow, even if I don’t have the slightest idea how they could be different from the rest.

I finally found it. While trying to export my flickering mesh to fbx, I finally got an error that pointed me in the right direction. Turns out I had some invalid bonemaps in my sections. I had only dealt with those bones that were actually weighted (influence greater zero) and ignored the rest. That was the problem. After properly mapping all vertex bone influences up to MAX_TOTAL_INFLUENCES to the containing section, there’s no more flickering. Just in case someone has a similar problem…