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

5.1 crash (RayTracingGeometry->Initializer.TotalPrimitiveCount)

scott-hf opened this issue · comments

Assertion failed: RayTracingGeometry->Initializer.TotalPrimitiveCount > 0
RealtimeMeshComponentProxy.cpp] [Line: 286]

Assertion failed: RayTracingGeometry->Initializer.TotalPrimitiveCount > 0 [File:U:\p4-ueprojects\PrjEfzDepot\PrjEfz\Plugins\RealtimeMeshComponent-master\Source\RealtimeMeshComponent\Private\RenderProxy\RealtimeMeshComponentProxy.cpp] [Line: 286]

UnrealEditor_RealtimeMeshComponent!<lambda_0e31874707250b4a195aa0efd90a9454>::operator()() [U:\p4-ueprojects\PrjEfzDepot\PrjEfz\Plugins\RealtimeMeshComponent-master\Source\RealtimeMeshComponent\Private\RenderProxy\RealtimeMeshComponentProxy.cpp:286]
UnrealEditor_RealtimeMeshComponent!RealtimeMesh::FRealtimeMeshSectionProxy::CreateMeshBatch() [U:\p4-ueprojects\PrjEfzDepot\PrjEfz\Plugins\RealtimeMeshComponent-master\Source\RealtimeMeshComponent\Private\RenderProxy\RealtimeMeshSectionProxy.cpp:107]
UnrealEditor_RealtimeMeshComponent!RealtimeMesh::FRealtimeMeshSectionGroupProxy::CreateMeshBatches() [U:\p4-ueprojects\PrjEfzDepot\PrjEfz\Plugins\RealtimeMeshComponent-master\Source\RealtimeMeshComponent\Private\RenderProxy\RealtimeMeshSectionGroupProxy.cpp:166]
UnrealEditor_RealtimeMeshComponent!RealtimeMesh::FRealtimeMeshLODProxy::CreateMeshBatches() [U:\p4-ueprojects\PrjEfzDepot\PrjEfz\Plugins\RealtimeMeshComponent-master\Source\RealtimeMeshComponent\Private\RenderProxy\RealtimeMeshLODProxy.cpp:83]
UnrealEditor_RealtimeMeshComponent!RealtimeMesh::FRealtimeMeshProxy::CreateMeshBatches() [U:\p4-ueprojects\PrjEfzDepot\PrjEfz\Plugins\RealtimeMeshComponent-master\Source\RealtimeMeshComponent\Private\RenderProxy\RealtimeMeshProxy.cpp:89]
UnrealEditor_RealtimeMeshComponent!RealtimeMesh::FRealtimeMeshComponentSceneProxy::GetDynamicRayTracingInstances() [U:\p4-ueprojects\PrjEfzDepot\PrjEfz\Plugins\RealtimeMeshComponent-master\Source\RealtimeMeshComponent\Private\RenderProxy\RealtimeMeshComponentProxy.cpp:307]
UnrealEditor_Renderer!FDeferredShadingSceneRenderer::GatherRayTracingWorldInstancesForView() [D:\build++UE5\Sync\Engine\Source\Runtime\Renderer\Private\DeferredShadingRenderer.cpp:1047]
UnrealEditor_Renderer!FDeferredShadingSceneRenderer::Render() [D:\build++UE5\Sync\Engine\Source\Runtime\Renderer\Private\DeferredShadingRenderer.cpp:2539]
UnrealEditor_Renderer!RenderViewFamilies_RenderThread() [D:\build++UE5\Sync\Engine\Source\Runtime\Renderer\Private\SceneRendering.cpp:4390]
UnrealEditor_Renderer!<lambda_d825e7d5a738e0bb6b7e834ee381bd9e>::operator()() [D:\build++UE5\Sync\Engine\Source\Runtime\Renderer\Private\SceneRendering.cpp:4668]
UnrealEditor_Renderer!TEnqueueUniqueRenderCommandType<FRendererModule::BeginRenderingViewFamilies'::87'::FDrawSceneCommandName,<lambda_d825e7d5a738e0bb6b7e834ee381bd9e> >::DoTask() [D:\build++UE5\Sync\Engine\Source\Runtime\RenderCore\Public\RenderingThread.h:206]
UnrealEditor_Renderer!TGraphTask<TEnqueueUniqueRenderCommandType<FRendererModule::BeginRenderingViewFamilies'::87'::FDrawSceneCommandName,<lambda_d825e7d5a738e0bb6b7e834ee381bd9e> > >::ExecuteTask() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:1348]
UnrealEditor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:760]
UnrealEditor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:649]
UnrealEditor_RenderCore!RenderingThreadMain() [D:\build++UE5\Sync\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp:415]
UnrealEditor_RenderCore!FRenderingThread::Run() [D:\build++UE5\Sync\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp:541]
UnrealEditor_Core!FRunnableThreadWin::Run() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp:149]

actually it looks like this is happening when i updated my project to 5.2 as well

i resolved it with the following:

				FMeshBatch MeshBatch;
				FRealtimeMeshBatchCreationParams Params
				{
					[](const TSharedRef<FRenderResource>&) {  },
					[MeshBatch = &MeshBatch]()-> FMeshBatch& { *MeshBatch = FMeshBatch(); return *MeshBatch; },	
					[&OutRayTracingInstances, LocalToWorld = GetLocalToWorld(), FeatureLevel = GetScene().GetFeatureLevel()](const FMeshBatch& Batch, float MinScreenSize, const FRayTracingGeometry* RayTracingGeometry)
					{
						if(RayTracingGeometry->Initializer.TotalPrimitiveCount > 0)
						{
						check(RayTracingGeometry->Initializer.TotalPrimitiveCount > 0);
						check(RayTracingGeometry->Initializer.IndexBuffer.IsValid());
						checkf(RayTracingGeometry->RayTracingGeometryRHI, TEXT("Ray tracing instance must have a valid geometry."));
						FRayTracingInstance RayTracingInstance;
						RayTracingInstance.Geometry = RayTracingGeometry;
						RayTracingInstance.InstanceTransforms.Add(LocalToWorld);
						
						RayTracingInstance.Materials.Add(Batch);

#if ENGINE_MAJOR_VERSION == 5 && ENGINE_MINOR_VERSION < 2
RayTracingInstance.BuildInstanceMaskAndFlags(FeatureLevel);
#endif
OutRayTracingInstances.Add(RayTracingInstance);
}
},
GetUniformBuffer(),
LODScreenSizes,
LODMask,
IsMovable(),
IsLocalToWorldDeterminantNegative(),
IsShadowCast(Context.ReferenceView)
};

				if(OutRayTracingInstances.Num() > 0)
				{
					RealtimeMeshProxy->CreateMeshBatches(LODIndex, Params, Materials, nullptr, ERealtimeMeshSectionDrawType::Dynamic, true /* bForceDynamicPath */);

				}

"if(RayTracingGeometry->Initializer.TotalPrimitiveCount > 0)"

"if(OutRayTracingInstances.Num() > 0)"

oops. both scott_hf and this account are mine.

This should be fixed in the newest version!

If you have this or any other issue in the future, feel free to open a new ticket!