Hello, In our efforts to optimize some critical paths we’ve continually noticed that some areas of our game tend to exhibit high GPU and render thread costs due to continuous Lumen Scene updates (updating things like lumen scene cards and global distance fields).
We are wondering if there are simple view modes or tools the engine ships with that we can use to specifically pin down where these expensive updates are coming from.
I’ve heard in passing that a lot of these updates can happen dynamically for fast moving Movable objects that have Affects Distance Field Lighting enabled, but with potentially thousands of objects in the scene it’s hard to immediately determine what would be causing these updates without writing specific tools for it.
Would also love to hear what kinds of settings or CVars are most suitable here if they help remove some of these costs while keeping Lumen quality acceptable.
Hi there,
Yes, there are several visualizations and tools that you can use to help you track down the sources of these updates.
For the lumen cards you can use `r.Lumen.Visualize.CardPlacement 1`, to visualize the current cards being processed. This should correspond almost exactly to the source of the mesh card update tasks you are seeing in Insights.
You can also use `r.LumenScene.SurfaceCache.LogUpdates` set to 1 or 2 (for verbose mesh name information) to log surface cache updates to the output log.
For distance field update debugging, you can visualize updates with: `ShowFlag.VisualizeGlobalDistanceField 1` (or enable from Show -> Visualize -> Global DistanceField) + `r.GlobalDistanceField.Debug.DrawModifiedPrimitives 1`.
When visualizing the global distance field you can also display stats with r.GlobalDistanceField.Debug.ShowStats 1. Distance field update logging can be enabled with `r.GlobalDistanceField.Debug.LogModifiedPrimitives 1`.
Any moveable objects, that affect the global distance field, will update distance field pages, overlapped by that object, whenever it moves. Camera movement will also trigger updates for newly exposed pages. Therefore, high camera movement speed could also be a factor here. If your camera is moving quickly, you may want to consider enabling r.AOGlobalDistanceField.FastCameraMode, for this section.
Lumen card updates are processed for all meshes near the camera (based on the lumen cards relative size on screen and distance from the camera) regardless of whether they are moving or not. For Lumen cards, you can control the culling distance with r.RayTracing.Culling.Radius if Lumen HW ray tracing is being used, and r.LumenScene.GlobalSDF.ClipmapExtent otherwise. You can also control the culling based on projected card resolution using r.LumenScene.SurfaceCache.CardMinResolution, and the Lumen Scene Detail post processing setting. The post processing settings are probably your best bet to adjust quality / performance trade offs in particular areas.
Let me know if you still have anymore questions
Regards,
Lance Chaney