Commit Graph

436 Commits

Author SHA1 Message Date
florian penzkofer
35284177bc Fix firing assertion caused by calling RemoveAt with invalid index (even though count is 0)
#rb Florin.Pascu
#jira UE-207465

[CL 31721534 by florian penzkofer in ue5-main branch]
2024-02-22 10:22:09 -05:00
patrick kelly
0411212ac1 HeterogeneousVolumes: Fix crash when collecting shadow-casting primitives and selecting rendering bounds.
#rb Stu.McKenna
#jira UE-207615

[CL 31673826 by patrick kelly in ue5-main branch]
2024-02-20 22:14:57 -05:00
patrick kelly
3906f2f86c Only collect HV primitives if the shadow is volumetric
#rb Stu.McKenna

[CL 31390963 by patrick kelly in ue5-main branch]
2024-02-12 13:26:59 -05:00
zach bethel
2e0fcae7c9 Added wait stats for common parallel stall points.
[CL 30981525 by zach bethel in ue5-main branch]
2024-01-29 19:25:39 -05:00
patrick kelly
36380c6163 Heterogeneous Volumes: Initial shadow-casting support and integration with translucency pass.
#rb stu.mckenna krzysztof.narkowicz
#jira UE-190041

[CL 30914925 by patrick kelly in ue5-main branch]
2024-01-26 00:33:50 -05:00
steve robb
f029468598 Fixed up a lot of bool-taking container resize functions to take EAllowShrinking instead.
[CL 30729174 by steve robb in ue5-main branch]
2024-01-19 16:41:35 -05:00
ola olsson
5064153aca Remove the invalidating instance list from GPUScene (where it never belonged) and instead add to the VSM cache manager, via an interface to collect the dynamic instances where needed.
#jira UE-141201
#rb andrew.lauritzen

[CL 30629752 by ola olsson in ue5-main branch]
2024-01-16 03:51:00 -05:00
zach bethel
4768615b49 Fixed missing shadows on mobile due to skipping shadow GDME if no tasks are used.
[CL 30547090 by zach bethel in ue5-main branch]
2024-01-10 15:29:22 -05:00
jon cain
a85098913c Change Editor viewport orthographic debug views to utilise the camera view origin update paths, allowing Lit modes to be used in editor.
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]
2024-01-10 11:16:04 -05:00
andrew lauritzen
57a2260da0 Per-instance static/dynamic caching and support clipmap-level-specific WPO disable distance
- 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]
2023-12-12 15:12:11 -05:00
dmitriy dyomin
3fd043a9d9 Added ability to turn some of FReadOnlyCVARCache properties into compile time constants
#rb Jack.Porter

[CL 30108937 by dmitriy dyomin in ue5-main branch]
2023-12-05 01:26:12 -05:00
zach bethel
dc459f1371 Fixed crash due to GDME task running unbounded when number of shadows to gather is 0.
[CL 30092404 by zach bethel in ue5-main branch]
2023-12-04 15:16:55 -05:00
ola olsson
937b798a19 Removed redundant FScene parameter passed in many places to GPU-Scene functions, fixed typo in OnPostLigtSceneInfoUpdate, & fixed the primitive ID in the debug rendering.
#rb Charles.deRousiers

[CL 29931072 by ola olsson in ue5-main branch]
2023-11-27 05:43:31 -05:00
Wei Liu
ec417ddb57 Fix a bug of CSM caching that the static primitves are renderred twice.
#jira none

#rb Ola.Olsson

[CL 29838083 by Wei Liu in ue5-main branch]
2023-11-20 04:52:40 -05:00
wouter dek
5b988f2716 Fix issue where DF shadows and far shadow culling would not work correctly when ForceOnlyVirtualShadowMaps=1
#rb andrew.lauritzen
#jira UE-199801

[CL 29816331 by wouter dek in ue5-main branch]
2023-11-17 14:24:06 -05:00
ola olsson
cf671375a4 Change GPU-Scene to use persistent primitive ID instead of the packed index.
- 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]
2023-11-15 06:19:15 -05:00
dmitriy dyomin
fe8d9677fc Help compiler to compile out unused ShadingPath renderer code on platforms with a static feature level. (cuts ~2.5MB from a mobile only binary size)
#rb jack.porter

[CL 29710801 by dmitriy dyomin in ue5-main branch]
2023-11-14 08:32:05 -05:00
dmitriy dyomin
e947de61d9 Moved FReadOnlyCVARCache to RenderCore module
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]
2023-11-13 09:13:11 -05:00
zach bethel
e8499f1594 Fixed memory stomp when shadows allocate views from instance culling manager while main views do as well.
- Solution is to move view allocation into a task that cannot start until shadow GDME is triggered.

[CL 29563758 by zach bethel in ue5-main branch]
2023-11-08 11:54:00 -05:00
wouter dek
f36b6a34fb Set default value for ForceOnlyVirtualShadowMaps to 1
#jira UE-198267
#rb andrew.lauritzen

[CL 29397527 by wouter dek in ue5-main branch]
2023-11-03 00:56:19 -04:00
zach bethel
391eaf38cf Implemented parallel Gather Dynamic Mesh Elements (GDME) for visibility and shadows.
- 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]
2023-10-31 16:36:46 -04:00
zach bethel
99b678aba2 Moved view-independent GPU scene updates to run prior to init views to overlap with visibility, reducing the critical path.
#rb ola.olsson

[CL 29019833 by zach bethel in ue5-main branch]
2023-10-23 12:43:43 -04:00
krzysztof narkowicz
d89e26c6dd Initial prototype of Stochastic Shadows.
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]
2023-10-13 18:26:48 -04:00
jamie hayes
351130f82a [Backout] - CL28322715
[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]
2023-10-03 14:18:51 -04:00
zach bethel
e6b20f9c77 Optimized cached shadow map size access (i.e. only iterate once through shadow linked list) and modified shadow render targets to take a non-immediate command list.
[CL 28324055 by zach bethel in ue5-main branch]
2023-09-28 14:11:06 -04:00