Also fixed a couple of minor bugs with projection matrix calculations and improved shadow LOD resolves in various orthographic views (perspective remains unnaffected).
There are some limitations to this fix due to near clip plane locations, but also introduced a CVar to allow users to adjust the near clip plane for debug purposes. Does not affect non-editor builds at all.
#rb Jeremy.Moore
[CL 30537782 by jon cain in ue5-main branch]
- Improves various situations around instanced geometry (commonly foliage) getting transitioned to dynamic caching and never going back
- Improves performance in scenes with heavy foliage using WPO animation and WPO distance disable
- Support disabling WPO animation in clipmaps past a certain point (based on the WPO disable distance). Works even when caching/static caching is disabled as it can still be a good performance tool.
- Add cvar for greedy clipmap level selection; disabled by default. While this is a behavior change it addresses some old issues around coarse pages getting greedily chosen at certain angles, and also makes the behavior around the new WPO distance disable more predictable
- Invalidate instances when the evaluate WPO/WPO distance changes
- Invalidate clipmaps when the resolution changes enough that it would trigger different clipmap levels to enable/disable animation. This can be caused by resolution or FOV changes. While it's possible for dynamic resolution to trigger this, TBD whether it's a practical issue for it to happen occasionally. If need be we could add some hysteresis but it would also add additional tracking and complexity and just move when we have to invalidate anyways.
Few other misc fixes and improvements.
#jira UE-197817
#rb ola.olsson
[CL 30273485 by andrew lauritzen in ue5-main branch]
- removes the need to reupload primitives that change packed index and to patch instance data accordingly.
#rb zach.bethel, tiago.costa, patrick.kelly, Graham.Wihlidal
[CL 29742503 by ola olsson in ue5-main branch]
Cleaned up and made more rendering read-only cvars go through this cache
It now can cache platform specific cvars, in non-editor builds
#rb jack.porter
[CL 29681907 by dmitriy dyomin in ue5-main branch]
- Added r.ParallelGatherDynamicMeshElements to control whether the feature is enabled. When disabled, tasks are constrained to the render thread as before.
- Added r.Visibility.DynamicMeshElements.NumTasks and r.Shadow.DynamicMeshElements.NumTasks which both default to 4. Thread contention becomes an issue at higher task counts for proxies which do a lot of uniform buffer or resource creation / updates.
Implementation Details:
The scene view visibility path typically has many dynamic elements per view, whereas there are typically more shadow views processing fewer elements each.
The main visibility path pushes dynamic primitives into a queue which is then processed by N async tasks, each with its own mesh collector and global vertex / index buffer. If a scene proxy is marked as not supporting parallel GDME, it is processed instead on the render thread in parallel with other async tasks. Niagara is currently the only proxy which is marked as unsupported by parallel GDME, as it has many potential sync points that would need to be untangled. When the async tasks complete, the task contexts are merged back to the view in an async task prior to launching dynamic mesh passes. Another important detail is that all material and GPU scene ops are deferred by the mesh collector and finalized at the end on the render thread. Deferring materials is necessary to allow the VT update task to overlap with GDME. The GPU scene updates are not thread safe and must be deferred.
The shadow path instead creates a queue of FProjectedShadowInfo's which is processed in parallel by async gather tasks (each with its own collector context). If a particular shadow has proxies that do not support parallel GDME, then a second pass is done over that FProjectedShadowInfo on the render thread to process the render thread only proxies. The dynamic mesh passes are launched asynchronously as well and are waited on by the shadow depth rendering passes later in the frame.
#rb krzysztof.narkowicz, christopher.waters
[CL 29289633 by zach bethel in ue5-main branch]
Stochastic Shadows are designed to scale up ray traced shadows to handle lots of lights in the scene at a relatively constant performance. They are stochastically sampling the shadowing part using a constant ray budget, while direct lighting is calculated separately every frame. This limits how well it can scale with the number of lights, but on the other hand there�s no noise, blurriness or ghosting in direct lighting.
Supports distance field tracing, screen traces and hardware ray tracing. Hardware ray tracing is augmented with screen space traces, which allows it to reduce Nanite Fallback mesh self-shadowing errors.
Runs at ~3ms on the console at 1080p in Highrise level of Shooter game, which has 132 shadow casting point lights.
It�s still under heavy development, so has lots of missing parts:
* Denoiser isn�t complete - has excessive ghosting and no spatial pass
* For software ray tracing only lower quality Global Distance Field traces are supported
* No support for translucency and fog volume
* Screen space traces have bias issues causing self-intersection
* GPU Light Scene Id management doesn�t work correctly
* No light function or IES support
* In general various bugs and missing performance optimizations
#rb none
[CL 28776845 by krzysztof narkowicz in ue5-main branch]
[FYI] zach.bethel
Original CL Desc
-----------------------------------------------------------------
Moved GPU scene to happen prior to GDME to increase overlap with visibility tasks.
[CL 28423679 by jamie hayes in ue5-main branch]