When changing LOD level, there are some left over jobs/call to:
// D:\UnrealEngine\Engine\Plugins\Animation\DeformerGraph\Source\OptimusCore\Private\DataInterfaces\OptimusDataInterfaceAdvancedSkeleton.cpp void FOptimusAdvancedSkeletonDataProviderProxy::AllocateResources(FRDGBuilder& GraphBuilder, FAllocationData const& InAllocationData){ ... // on LOD transition InvocationIndex >= AttributeBuffers.Num() BuffersPerAttributePerSection[InvocationIndex].AddDefaulted(AttributeBuffers[InvocationIndex].Num()); ...And because AttributeBuffers size does not reflect the current LOD level anymore it triggers a segfault/buffer overflow.
Proposed fix:
The fix I found is simple, FOptimusAdvancedSkeletonDataProviderProxy::IsValid() should check that AttributeBuffers is still correct:
FOptimusAdvancedSkeletonDataProviderProxy::IsValid(){ ... // this should probably be added: if (AttributeBuffers.Num() != LodRenderData->RenderSections.Num()) { return false; }This way, AllocateRessources won’t be called on buffer outdated buffer size, and a call to UOptimusAdvancedSkeletonDataProvider::GetRenderProxy() will be triggered to update buffers according to the current LOD level.
For sake of completeness here is the model I have used (“shinbi__sns_skin_weights.fbx” is used as skin weight profile for “shinbi_base_lodel.fbx”) 3 LOD were auto generated.
I submitted a fix for this to 5.6 stream, CL 42402131, could you give it a try and let me know?
You are absolutely right with your diagnosis. It was a bad idea to create LOD specific buffer during GetRenderProxy() since the LODIndex can be updated after the proxy is created. To fix the issue, we have moved the construction of LOD specific buffers to AllocateResources(). Hope this CL addresses the issue for you. Thank you once again for the test assets and detailed report!!