Skeletal mesh merge broken?

I’ve been working on building a modular pawn system, and I’m encountering huge problems using FSkeletalMeshMerge to combine my character mesh parts and reduce draw calls. I’ve tried this in UE 4.7 and 4.8 with the same results. Whenever I try to merge certain parts of my character it will completely freak out and render messed up geometry all over the place. The expected result of merging the meshes should be this:

When I try to use FSkeletalMesh merge to merge the same pieces at load time however, I end up with this:

As you can see, there’s just a weird flickering mass of geometry there. If there’s a developer willing to look into this I’d be happy to build a test case project.

I’m using basically the exact code from [here][3]

EDIT: Tried to see which combinations of parts cause the problem to see if it might be a polycount issue.
Arms+Torso: 16619 polys (works)
Eyes+Legs+Head: 14088 polys (works)
Everything: 30707 polys (broken)
Head+Arms: 17548 polys (broken)
Torso+Legs: 11859 polys (broken)
It doesn’t seem to be.

EDIT 2: Seams to be a bone merging issue (possibly with small bones?), because testing with a model skinned to a single bone worked as expected.

Hey DarthCoder,

In this situation, it would really help me to be able to put my eyes on your project. Would you like to PM me a download after uploading your project to a cloud storage system (dropbox, drive, etc)?

-.

Yes, I’d be happy to. I’m putting together a minimal test project to demonstrate the error right now. I’ve been doing more testing and I’m thinking the error is likely related to the being merged.

Thanks, I’ll be taking a look.

I’d also like to note that any further updates can be made in comments. We aren’t actively notified about edits made to the original post.

-.

What engine version was this project created with? Any chance of migrating the content to a non-code project?

It was made with 4.8.2. It can’t be migrated to non-code unless FSkeletalMeshMerge is accessible from Blueprint somehow. I looked around, but I couldn’t find anything about it being usable in Blueprint.

Spent more time testing today and found that when ejecting from play mode and inspecting the mesh in persona the looks fine. However, when I try to display selected bone blend weights it crashes. I tried the exact thing on the other meshes and they were fine.

Realized I should include the relevant part of the crash log.

Access violation - code c0000005 (first/second chance not available)

UE4Editor_Engine!SkinVertexChunk<1,6,TGPUSkinVertexBase<1>,TGPUSkinVertexFloat16Uvs<1,1> >() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\skeletalrendercpuskin.cpp:774]
UE4Editor_Engine!SkinVertices,TGPUSkinVertexFloat16Uvs<1,1> >() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\skeletalrendercpuskin.cpp:899]
UE4Editor_Engine!FSkeletalMeshObjectCPUSkin::CacheVertices() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\skeletalrendercpuskin.cpp:287]
UE4Editor_Engine!FSkeletalMeshObjectCPUSkin::Update'::2’::EURCMacro_SkelMeshObjectUpdateDataCommand::DoTask() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\engine\private\skeletalrendercpuskin.cpp:184]
UE4Editor_Engine!TGraphTask<FSkeletalMeshObjectCPUSkin::Update'::2’::EURCMacro_SkelMeshObjectUpdateDataCommand>::ExecuteTask() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.8\engine\source\runtime\core\public\async\taskgraphinterfaces.h:753]

I finally got the mesh to display selected bone weights without crashing by connecting the debugger. I’m not sure exactly how that helped, but setting breakpoints around line 774 of SkeletalRenderCPUSkin and stepping through a few times made it so I could view it without crashing. This is what it looks like when selecting each bone.

Not trying to rush you or anything. I’m just able to work on this on weekends mostly so that’s when most of my progress will end up being posted.

Just another observation about the issue here. I’ve been messing around with a custom engine build for a bit and if I get the vertex array using SrcLODModel.GetVertices(VertexArray);
then set DestVert.Position = VertexArray[VertIdx].Position; instead of using the VertexBufferGPUSkin it works just as before for other meshes, but the broken ones end up generating different broken geometry:

Just came up with a fix for it. I’m writing up an explanation of the fix and making a pull request now. I’ll put a link in an answer.

I’ve submitted a pull request with the fix here: https://github.com/EpicGames/UnrealEngine/pull/1437

Glad you figured it out. I had an email out to some engineers and have updated them that you’ve fixed the issue and created the pull request.