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 toExclude
-
CacheRayTracingPrimitive()
is executed for those primitives, but no RT cache data is generated becauseDrawnInGame=0
-
As the player moves, a FastGeo cluster becomes visible, and all its primitives are set to
DrawnInGame=1
with their RT flags set toCacheInstances
-
CacheRayTracingPrimitive()
is not executed for these primitives, which may be the root cause -
RayTracing::GatherRelevantStaticPrimitives()
executes, touches those primitives (since their RT flags areCacheInstances
), and crashes due to missing RT LOD data (becauseCacheRayTracingPrimitive()
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.