Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.1 crash (RayTracingGeometry->Initializer.TotalPrimitiveCount) #256

Closed
scott-hf opened this issue Jul 12, 2023 · 5 comments
Closed

5.1 crash (RayTracingGeometry->Initializer.TotalPrimitiveCount) #256

scott-hf opened this issue Jul 12, 2023 · 5 comments

Comments

@scott-hf
Copy link

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]

@HelloFriendGames
Copy link

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

@HelloFriendGames
Copy link

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 */);

				}

@HelloFriendGames
Copy link

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

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

@HelloFriendGames
Copy link

oops. both scott_hf and this account are mine.

@Koderz
Copy link
Member

Koderz commented Oct 24, 2023

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!

@Koderz Koderz closed this as completed Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants