TriAxis-Games / RealtimeMeshComponent

Unreal Engine 5 plugin component for rendering runtime generated content.

Home Page:https://rmc.triaxis.games/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flickering/Crash when updating URealtimeMeshSimple

1polygon opened this issue · comments

commented
2023.03.06.20.40.mp4

When updating the mesh using UpdateSectionMesh it sometimes disappears for a frame or the editor crashes. Also there's a short freeze on the first update.

Here is how i create the RealtimeMeshComponent on BeginPlay of a SceneComponent:

RealtimeMeshComponent = NewObject<URealtimeMeshComponent>(GetOwner());
RealtimeMeshComponent->RegisterComponent();
RealtimeMeshComponent->SetMaterial(0, Material);

And here is how i create/update the URealtimeMeshSimple on the game thread:

FRealtimeMeshSimpleMeshData MeshData;
MeshBuilder->Build(Data, Size - 1, MeshData);

if (!IsValid(RealtimeMesh))
{
	RealtimeMesh = RealtimeMeshComponent->InitializeRealtimeMesh<URealtimeMeshSimple>();
	MeshSectionKey = RealtimeMesh->CreateMeshSection(0, FRealtimeMeshSectionConfig(ERealtimeMeshSectionDrawType::Dynamic, 0), MeshData, true);
}
else
{
	RealtimeMesh->UpdateSectionMesh(MeshSectionKey, MeshData);
}

Crash report:

Assertion failed: (Offset + Size) == InOther->Offset [File:D:\build\++UE5\Sync\Engine\Source\Runtime\RHICore\Private\RHIPoolAllocator.cpp] [Line: 147]

UnrealEditor_RHICore
UnrealEditor_RHICore
UnrealEditor_RHICore
UnrealEditor_D3D12RHI
UnrealEditor_D3D12RHI
UnrealEditor_RHI
UnrealEditor_RHI
UnrealEditor_RHI
UnrealEditor_RHI
UnrealEditor_Core
UnrealEditor_Core
UnrealEditor_RenderCore
UnrealEditor_Core
UnrealEditor_Core
kernel32
ntdll

Plugin version 2c219aa
UE 5.1

I have same issue

I believe this has been fixes in the latest version. If not feel free to reopen this issue or create a new one!

Thanks,
Koderz

commented

Thanks for the update!

Unfortunately I still encounter the same issue using v5.0.5 with ue 5.2.
This is the project: https://github.com/1polygon/ue5-voxel/tree/ue-5.2-dev
And here is the part where the mesh is updated: https://github.com/1polygon/ue5-voxel/blob/c765dadc5bfea9d7c9a6c270aaff6ed3a5b235f1/Source/Voxel/Private/VoxelChunk.cpp#L70

I noticed that it works fine when updating vertex colors without changing the vertex/triangle count.

@1polygon This issue is mostly fixed I think in latest, but I think there is a random outstanding issue that I've only replicated once so far.