FastGeoStreaming with Raytracing

We are experiencing a crash when using the FastGeoStreaming plugin in combination with hardware ray tracing.

We have the following (relevant) settings enabled:

r.RayTracing=True
r.RayTracing.RayTracingProxies.ProjectEnabled=True
r.RayTracing.Shadows=False
r.RayTracing.UseTextureLod=True
r.SkinCache.CompileShaders=True
r.GenerateMeshDistanceFields=False

We also have a world partition level set up with FastGeoWorldPartitionRuntimeCellTransformer as the sole entry in the Runtime Cells Transformer Stack.

After enabling r.RayTracing, we began to encounter crashes in PIE inside RayTracing::GatherRelevantStaticPrimitives().
In this function, there was an FPrimitiveSceneInfo with its Flags set to ERayTracingPrimitiveFlags::CacheInstances, but its RayTracingLODData was empty.

While debugging, I found that FFastGeoComponentCluster::UpdateVisibility_Internal() toggles the FPrimitiveSceneProxy’s DrawnInGame flag based on cluster visibility.
The sequence of events in our scenario is roughly as follows:

  • PIE starts

  • The FastGeoStreaming plugin generates clusters

  • Some clusters are resolved as not visible, so all their primitives are set to DrawnInGame=0 and their RT flags are set to Exclude

  • CacheRayTracingPrimitive() is executed for those primitives, but no RT cache data is generated because DrawnInGame=0

  • As the player moves, a FastGeo cluster becomes visible, and all its primitives are set to DrawnInGame=1 with their RT flags set to CacheInstances

  • CacheRayTracingPrimitive() is not executed for these primitives, which may be the root cause

  • RayTracing::GatherRelevantStaticPrimitives() executes, touches those primitives (since their RT flags are CacheInstances), and crashes due to missing RT LOD data (because CacheRayTracingPrimitive() was never called)

As a temporary workaround, I added UpdateCachedRayTracingState(PrimitiveSceneProxy) at the end of FScene::UpdatePrimitivesDrawnInGame_RenderThread() to force an RT cache update for the affected primitives, which appears to solve the issue.

1 Like

Hi,

Thanks for reporting. This should be already fixed in UE5-main, and fix will be in 5.7.

1 Like