Commit Graph

78 Commits

Author SHA1 Message Date
andrew lauritzen
ead3650569 Virtual shadow maps: early out on pixels backfacing the light in both projection and page allocation
Page allocation part is a fairly minor benefit in most scenes but can occasionally make a big difference.
Projection early-out is a pretty uniform benefit all the time, especially with SMRT.

#preflight 612d1b836a14cc000118f03a
#rb ola.olsson

#ROBOMERGE-SOURCE: CL 17388425 via CL 17389280
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17389330 by andrew lauritzen in ue5-release-engine-test branch]
2021-09-01 13:13:01 -04:00
charles derousiers
a91bbfa21e Change & clean hair tile resources to share buffers for adding later on full/partially covered tile support.
#rb none
#preflight 612f604d677f0e0001866d50

#ROBOMERGE-OWNER: charles.derousiers
#ROBOMERGE-AUTHOR: charles.derousiers
#ROBOMERGE-SOURCE: CL 17385390 via CL 17387630
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17387665 by charles derousiers in ue5-release-engine-test branch]
2021-09-01 11:46:13 -04:00
graham wihlidal
29b4ac53b7 Implemented a new payload data allocator and buffer in GPU Scene that will be used to allow instances to dynamically allocate optional side-car data rather than always paying a fixed high watermark cost in the scene data layout (often features are never used by most instances).
#rb brian.karis
[FYI] christopher.waters, ola.olsson, krzysztof.narkowicz
#preflight 6123e56d8ff55400011df401
[FYI] Dmitriy.Dyomin

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 17275101 via CL 17276332
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v858-17259218)

[CL 17276338 by graham wihlidal in ue5-release-engine-test branch]
2021-08-23 16:47:16 -04:00
andrew lauritzen
eebbe18a26 Add flag to mark page requests/allocated pages as excludig non-nanite geometry.
Add cvar for including non-nanite geometry in coarse pages (so that one can disable for performance reasons). Default on.
Some general unused flags cleanup.

#rb rune.stubbe
#preflight 610ccc0e6c6eb0000196b59e

#ROBOMERGE-SOURCE: CL 17085350 via CL 17095081
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v853-17066230)

[CL 17095354 by andrew lauritzen in ue5-release-engine-test branch]
2021-08-07 15:19:34 -04:00
dmitriy dyomin
b0828d6beb Mobile specific implementation for auto-instancing. (disabled by default atm)
Run a compute job that packs most commonly used instance data (LocalToWorld matrix and some other bits - 80 bytes) into per-instance vertex buffer. Vertex shader does not have access to GPUScene and instead loads instance data from a per-instance vertex buffer. If it needs more primitive/instance data than available then it will load it from Primitive UB, binding unique uniform buffer and breaking auto-instancing. Pixel shader has a full access to a GPUScene
There are 3 ways how FSceneDataIntermediates gets populated
 1. PrimitiveId + GPUScene (Desktop)
 2. Per-Instance data + Primitive UB (Mobile)
 3. Primitive UB (auto-instancing disabled)
Details for GPUScene specific vertex inputs and access to FSceneDataIntermediates are hidden behind a macro:
VF_GPUSCENE_DECLARE_INPUT_BLOCK
VF_GPUSCENE_GET_INTERMEDIATES
FSceneDataIntermediates is now stored in FVertexFactoryIntermediates, FMaterialVertexParameters. Added a few GetPrimitiveData() overloads that allows you to access PrimitiveData depending on current context. Removed most of the cases where GetPrimitiveData() gets used with PrimitiveId.
#rb Ola.Ollson

#ROBOMERGE-SOURCE: CL 17093848 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v853-17066230)

[CL 17093856 by dmitriy dyomin in ue5-release-engine-test branch]
2021-08-07 07:20:52 -04:00
ola olsson
18895c0987 Add clear passes to fix capture replay issues on certain consoles.
#jira UE-118792
#rb andrew.lauritzen
#preflight 6101ad5f4cd7930001962d6e

#ROBOMERGE-SOURCE: CL 16994350 via CL 16994353
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 16994355 by ola olsson in ue5-release-engine-test branch]
2021-07-29 07:49:11 -04:00
andrew lauritzen
33ca74fba3 Implement persistent shadow physical page pool
- Eliminates the previous frame texture (~128MB in default config) and copy
- Cached pages are kept in place, with a quick pass to find and allocate free pages following
  - Experimented with a persistent free list but for the small numbers of pages we are talking about (2k-4k ish standard), recomputing the free list each frame was cheap and robust
  - Main cost is synchronization/barriers between the new passes. Fairly low measured overhead compared to the much larger wins, but can revisit later if need be.
- Removed a few things that added complexity but were not making a big difference to performance, especially with the changes:
  - No longer support "panning" the directional light cascade cached pages. With the changes to the snapping and depth range invalidations this was no longer making much of a difference anyways.
  - No longer do the hierarchical "eliminate parent if all 4 mip children are marked" for local lights. Tested a bit and it was not making a measurable difference in most cases with caching. Can be revived if useful later.
- Moved ownership of the now persistent physical pool to CacheManager
- A bunch of related cleanup and fixes

#rb ola.olsson
#preflight 61008a655938f90001f04260

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 16985509 via CL 16987414
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 16987415 by andrew lauritzen in ue5-release-engine-test branch]
2021-07-28 17:00:37 -04:00
andrew lauritzen
9e9c6bfa2c Remove unused/no longer working VSM paths
#ROBOMERGE-SOURCE: CL 16917622 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16917631 by andrew lauritzen in ue5-release-engine-test branch]
2021-07-21 19:04:20 -04:00
andrew lauritzen
37ebf8ceb4 Implement simple subsurface shading model for virtual shadow maps and related fixes and improvements:
- Add VirtualShadowMapId to forward light data, removing the per-view remapping table. Should fixe a few multi-view/split-screen bugs.
- Minor cleanup of PCF subsurface path; remove dead/broken code.
- Fix up blending of light attenuation into screen shadow mask; disable CSM fading when VSMs are enabled.
- Fix OnePassProjection flag when VSMs are disabled

#rb none
[FYI] ola.olsson, brian.karis

#ROBOMERGE-SOURCE: CL 16852407 via CL 16852415
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16852422 by andrew lauritzen in ue5-release-engine-test branch]
2021-07-14 13:45:31 -04:00
ola olsson
30b717b963 Combing GPU-Scene instance culling and the id-list generation into one step, and the same for VSM
- Uses the InstanceCullingLoadBalancer to pre-distribute the work on the CPU to ensure even load.
 - Make instance culling use the instance data offset in MDC instead of translating primitive IDs.
 - Track single-instance draws separately from instanced to optimize handling (disable culling for single-instance primitives).

#rb Graham.wihlidal,andrew.lauritzen
[FYI] dmitriy.dyomin
#preflight 60d0eafa2ab2180001269160

#ROBOMERGE-SOURCE: CL 16733827 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16733837 by ola olsson in ue5-release-engine-test branch]
2021-06-21 16:52:03 -04:00
andrew lauritzen
35f696abf5 Use conservative CPU cull volume for VSM clipmaps to avoid missing non-nanite geometry in cached pages.
Better labeling for some GPU profiling regions.
Fix to frustum vertex buffer usage flag.

#rb ola.olsson

#ROBOMERGE-SOURCE: CL 16675237 via CL 16675244
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16675251 by andrew lauritzen in ue5-release-engine-test branch]
2021-06-15 12:47:24 -04:00
graham wihlidal
f602dcf242 Big cleanup/refactor of InstanceData* (renamed to InstanceSceneData* to match many other places already calling it that, and to disambiguate upcoming changes that add another instance data buffer to GPU Scene for arbitrary data payloads). This change also removes the virtuals on FPrimitiveSceneProxy for the instance list along with lots of copy paste code for all the derived types, and instead makes it a built-in feature of the base proxy (since nearly everything supports GPU Scene instancing now).
#rb ola.olsson
[FYI] brian.karis
#preflight 60c4d5c586ce760001377f2a

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16660135 via CL 16660883
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v834-16658389)

[CL 16660909 by graham wihlidal in ue5-release-engine-test branch]
2021-06-14 13:43:26 -04:00
Ola Olsson
91ed2ab3ba Move instance ID buffer to RDG and out of the View uniform buffer and into own UB.
- Enables overlapping batched and non-batched instance culling (needed for batching work).
 - Removes some explicit transitions & minor cleanup.
 - Added tracking the required number of instances (fixes non-nanite VSM for large ISMs)

#rb graham.wihlidal,jian.ru,yujiang.wang,zach.bethel
#preflight 60b73f38107dc600017d931b

[CL 16544217 by Ola Olsson in ue5-main branch]
2021-06-03 02:19:28 -04:00
andrew lauritzen
e9c2267b53 Fix CPU-side structure to align with padding added to GPU structure.
#rb Charles.deRousiers

#ROBOMERGE-SOURCE: CL 16510863 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v826-16501804)

[CL 16510864 by andrew lauritzen in ue5-main branch]
2021-05-31 16:52:31 -04:00
andrew lauritzen
c373a4445f Fix depth range precision and offset/clamping issues with VSM cached pages
- Instead, create a reference depth range with a guard band that we reuse frame to frame until we get too close to the edge, at which point we invalidate that clipmap level's cached pages (if any)
- Does not significantly affect invalidations, even when moving quickly near surfaces, since those cases would already get invalidated when those pixels moved to a different clipmap level
- Sets up for not re-copying cached VSM pages every frame

#rb ola.olsson
[FYI] brian.karis

#ROBOMERGE-SOURCE: CL 16492432 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v823-16466674)

[CL 16492445 by andrew lauritzen in ue5-main branch]
2021-05-27 17:36:27 -04:00
zach bethel
2ab8c34577 Replaced FRDGBufferUploader with internal RDG upload. Removes several transitions and passes and removes immediate command list passes from the graph.
#rb jian.ru

[CL 16459303 by zach bethel in ue5-main branch]
2021-05-25 20:46:17 -04:00
andrew lauritzen
93dd5946b6 Re-implement debug output visualization for VSM projection
Use actor label for light identification/selection in editor; fall back on component name (UUID) temporarily until this data is made available outside the editor as well
Collect debug data in RayState for SMRT and return the last valid sample data
- Alternative is to always generate debug data based on just a single VSM sample even when SMRT is enabled, but it's useful to have a debug output path for the true SMRT data, even if a bit more complex
Move some common visualization utilities to /Visualization.ush
Implement but disable backface culling for shadow evaluation pending change that handles various SHADINGMODEL's properly

#rb graham.wihlidal, ola.olsson

#ROBOMERGE-SOURCE: CL 16407102 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v804-16311228)

[CL 16412421 by andrew lauritzen in ue5-main branch]
2021-05-20 19:32:20 -04:00
richard wallis
2eef69096c PhysicalPagePool needs to be UInt compatible and PhysicalPagePoolHw needs to be float compatible. Slightly modified version of CL by Andrew Lauritzen after testing on macOS Big Sur.
#jira UE-116080
[REVIEW] [at]Andrew.Lauritzen,  [at]Juan.Canada,  [at]will.damon

#ROBOMERGE-SOURCE: CL 16406023 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v804-16311228)

[CL 16406075 by richard wallis in ue5-main branch]
2021-05-20 13:24:00 -04:00
graham wihlidal
36beb84c0e - Added the ability to disallow falling back to proxy meshes if Nanite isn't supported by the platform (or if it is, but atomics are not supported). Default is proxy rendering, but some projects may not be built with proxy fallback in mind. Controlled with r.Nanite.ProxyRenderMode (0=fallback, 1=never render, 2=never render except SM editor toggle).
- Require 64bit atomic support for Nanite by default now (r.Nanite.RequireAtomic64Support=1)
- Cleaned up a bunch of cvar component reattach callbacks to use lambdas instead of redundant global functions
- Added UStaticMesh::HasValidNaniteData() as a helper to check if an asset has valid Nanite data
- Improved Nanite unsupported on screen error message so that we don't asks the user to update GPU drivers on a console :)

#rb nick.whiting
#jira UETOP-1646
[FYI] brian.karis, michal.valient

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16363554 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v804-16311228)
#ROBOMERGE-CONFLICT from-shelf

[CL 16363648 by graham wihlidal in ue5-main branch]
2021-05-17 22:54:18 -04:00
zach bethel
7c28e71d9e Batch RDG upload passes together to reduce transitions and RDG compilation work.
#rb charles.derousisers, andrew.lauritzen
#jira UE-114621

[CL 16209728 by zach bethel in ue5-main branch]
2021-05-05 13:20:09 -04:00
Charles deRousiers
212469d965 Add indirect tile dispatch for marking shadow page covered by hair.
Review:  https://p4-swarm.epicgames.net/reviews/15901055/v1/

#rb andrew.lauritzen
#jira none

[CL 16182843 by Charles deRousiers in ue5-main branch]
2021-05-03 05:07:00 -04:00
andrew lauritzen
2b2b3adc5f Add a shadow depth VS permutation for non-nanite vsm to avoid the need for a read-only project setting
PS already has a permutation (bAtomicWrites) so this primarily affects offline compilation
Leaving the function of NonNaniteVSM the same for now to minimize the surface area of the change, but the shader and other logic can be simplified in the future
NonNaniteVSM can become a dynamic debug cvar in the future once we are happy this is working

#jira UETOP-1088
#lockdown graham.wihlidal
#rb ola.olsson, krzysztof.narkowicz
[FYI] nick.whiting

#ROBOMERGE-SOURCE: CL 16057407 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v789-15992632)

[CL 16061153 by andrew lauritzen in ue5-main branch]
2021-04-20 10:31:17 -04:00
rolando caloca
54bec85390 UE5EA - Enable Nanite on Vulkan, fixes rendering issues
[FYI] Mihnea.Balta
#rb Zach.Bethel, Brian.Karis

#ROBOMERGE-SOURCE: CL 16038169 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v789-15992632)

[CL 16038203 by rolando caloca in ue5-main branch]
2021-04-16 15:06:03 -04:00
andrew lauritzen
181bc2e497 Reenable VSM HZB to help with some of the Nanite buffer overrun cases
Add virtual clipmap levels near the camera to cover extreme close-ups
Add Nanite view compation debug output
Make VSM resolution lod bias consistent for directional and local lights
Remove some unnecessary code from ProjectionCommon.ush which gets included in material shaders

#jira UETOP-1088
#rb graham.wihlidal, ola.olsson
[FYI] brian.karis
#lockdown graham.wihlidal

#ROBOMERGE-SOURCE: CL 15994600 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v789-15992632)

[CL 15994621 by andrew lauritzen in ue5-main branch]
2021-04-13 16:54:28 -04:00
simon tourangeau
d42f8bc6da Separate CVar for HZB for VSMs vs Atlases.
Add light name to non-nanite VSM raster passes.

#rb graham.wihlidal
#lockdown michal.valient

#ROBOMERGE-OWNER: simon.tourangeau
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15967887 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v787-15839533)
#ROBOMERGE-CONFLICT from-shelf

[CL 15988175 by simon tourangeau in ue5-main branch]
2021-04-13 08:27:58 -04:00