Commit Graph

49 Commits

Author SHA1 Message Date
andrew lauritzen
b3d0079200 Better naming for different HZBs.
Clean up VSM HZB by moving to previous frame data and removing redundantly exported previous frame page table.
For view contexts with VSM caching "show flag" disabled, also disable HZB so we aren't leaking HZB references out of these graphs either.

#rb graham.wihlidal
[FYI] brian.karis

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15826082 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v785-15821902)
#ROBOMERGE-CONFLICT from-shelf

[CL 15833868 by andrew lauritzen in ue5-main branch]
2021-03-25 18:19:54 -04:00
brian karis
d4981a121b Cubemap VSM no longer draws NumFaces^2 instances.
#rb ola.olsson

#ROBOMERGE-SOURCE: CL 15785126 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269)

[CL 15790690 by brian karis in ue5-main branch]
2021-03-23 22:41:18 -04:00
andrew lauritzen
2e95eb31b4 Add cvar for resizing the virtual shadow map physical page pool
Refactoring to clean up some cross-frame resource references and enable more explicit allocations if needed
Allow nanite to take an external depth buffer to write to instead of creating one internally.

#rb ola.olsson

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15781280 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v783-15756269)
#ROBOMERGE-CONFLICT from-shelf

[CL 15789787 by andrew lauritzen in ue5-main branch]
2021-03-23 21:23:57 -04:00
Guillaume Abadie
5ebd677973 Replaces SHADER_PARAMETER_RDG_BUFFER() with RDG_BUFFER_ACCESS() in nanite
#rb none
#fyi graham.wihlidal
#robomerge Release-5.0-EarlyAccess

[CL 15718938 by Guillaume Abadie in ue5-main branch]
2021-03-17 05:55:03 -04:00
andrew lauritzen
92b07781d7 Always use compute shader for VSM projection
- Adaptive ray counts for SMRT now work even with pass per light
- Removes a few divergences between the logic in the two paths

Remove debug projection stuff for now; will reimplement with a separate UAV write later

Remove temporal filtering for denoiser (it was broken and would need to be implemented slightly differently with the new path anyways)

Split cvar to allow separate denoiser toggle for directional (default on) and local (default off) lights

Enable SMRT for local lights and VSM caching by default

#rb brian.karis

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15707229 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v781-15675533)
#ROBOMERGE-CONFLICT from-shelf

[CL 15708180 by andrew lauritzen in ue5-main branch]
2021-03-15 22:06:28 -04:00
andrew lauritzen
9b0a6fab9d Remove complete shadow maps and replace with direct VSM sampling
- Move VSM parameters into a single uniform buffer; required for base pass rendering.
  - SRVs are initialized to dummy data until they are computed during the frame and subsequently updated before any VSM sampling.
  - Make names and usage more consistent with other UB bindings in mesh passes
- Direct injection of VSM into translucent volume and fog
- Support VSM sampling in forward lighting shaders
  - Enabled and bound currently for translucent forward and single pass water meshes
- Support VSM sampling in sky atmosphere and cloud rendering
  - NOTE: Sky atmosphere LUT pass currently executes before BasePass and ShadowDepths so it will not sample proper data and throw a warning. Moving passes around to address this will come in a future commit.

#rb Brian.Karis, Ola.Olsson, Sebastien.Hillaire, Zachary.Bethel

#ROBOMERGE-OWNER: andrew.lauritzen
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 15649858 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v779-15635321)
#ROBOMERGE-CONFLICT from-shelf

[CL 15650486 by andrew lauritzen in ue5-main branch]
2021-03-08 23:14:54 -04:00
Charles deRousiers
600160e3eb Simplify hair resources binding for virtual shadow map.
#rb andrew.lauritzen
#jira none

[CL 15622753 by Charles deRousiers in ue5-main branch]
2021-03-05 05:14:13 -04:00
charles derousiers
5cfef59875 Add support for virtual shadowing for hair strands.
#rb andrew.lauritzen

#ROBOMERGE-SOURCE: CL 15580360 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v776-15580269)

[CL 15580380 by charles derousiers in ue5-main branch]
2021-03-03 06:14:14 -04:00
ola olsson
09532969fe Added (read only) cvar r.Shadow.Virtual.NonNaniteVSM to toggle non-nanite VSM support
#rb Brian.Karis,Andrew.Lauritzen

#ROBOMERGE-SOURCE: CL 15526905 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15526909 by ola olsson in ue5-main branch]
2021-02-25 05:03:27 -04:00
brian karis
43ca1bf181 VSM atomic depth writes
#rb ola.olsson, andrew.lauritzen

#ROBOMERGE-SOURCE: CL 15492121 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15492123 by brian karis in ue5-main branch]
2021-02-22 14:47:36 -04:00
ola olsson
669e1e6623 Misc Non-Nanite VSM and GPU-Scene instance culling fixes.
- Fix ordering issue in virtual shadow map setup (need to commit and upload dynamic primitive data before building rendering commands).
- Workaround for incorrect culling of late (shadow view) dynamic primitives.
- Mark local lights as rendered.

#rb Brian.Karis

#ROBOMERGE-SOURCE: CL 15470869 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15470873 by ola olsson in ue5-main branch]
2021-02-19 06:38:56 -04:00
andrew lauritzen
ceabdff2a2 - Add support to mark coarse pages in mips/clipmap levels
- Fix optimal plane bias with clipmap LOD fallback
- Clean up and optimize some of the clipmap level offset math
- Rename some fields to make the resuse between clipmaps/mips clear

#rb brian.karis, ola.olsson

#ROBOMERGE-SOURCE: CL 15466663 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15466676 by andrew lauritzen in ue5-main branch]
2021-02-18 21:09:05 -04:00
graham wihlidal
200151a3bc Renamed r.Shadow.v.* cvars to r.Shadow.Virtual.* to be more obvious, and also renamed VSM.* resource prefixes to Shadow.Virtual.*
#rb brian.karis
[FYI] ola.olsson, andrew.lauritzen

#ROBOMERGE-SOURCE: CL 15450709 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15454805 by graham wihlidal in ue5-main branch]
2021-02-18 13:44:36 -04:00
graham wihlidal
579f03fbaa Prefixed Nanite and VSM resources so that RDG filtering works nicely.
#rb trivial
[FYI] brian.karis, zach.bethel

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

[CL 15454700 by graham wihlidal in ue5-main branch]
2021-02-18 13:40:42 -04:00
ola olsson
f7822cb8c5 Enable caching for Non-Nanite VSM
- added a path to propagate and cache whether material modifies position (WPO) to enable invalidating cached pages (touches whole mesh command pipeline).
- added pixel shader verision of page copying & clearing.
- also added flag for whether cached the mesh draw command supports primitive id (which enables checing this earlier).

#rb andrew.lauritzen,brian.karis,graham.wihlidal,Krzysztof.Narkowicz

#ROBOMERGE-SOURCE: CL 15436539 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15441336 by ola olsson in ue5-main branch]
2021-02-17 15:32:52 -04:00
brian karis
10ccb264da Fixed AllocatePagesUsingRects with Nanite
#rb none
[FYI] ola.olsson

#ROBOMERGE-SOURCE: CL 15400374 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15400383 by brian karis in ue5-main branch]
2021-02-12 21:06:10 -04:00
andrew lauritzen
c9627e03e2 Rearrage clipmaps so that their snapping aligns more across levels
- Levels are now strictly pow2 sizes and snap to half their size (instead of internal page boundaries).
- Propogate mips propgates along clipmap levels instead of mips for directional lights
- Provide a O(1) lookup for clipmaps as well that will fall back to coarser data. Do not use it by default for current opaque shading where we know by construction where the mapped pages are.
Still some minor cleanup and optimization possible to come in a future commit.

#ROBOMERGE-SOURCE: CL 15399904 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15399908 by andrew lauritzen in ue5-main branch]
2021-02-12 19:00:35 -04:00
brian karis
7743e10ae8 Fixed cubemap shadows being inverted and flipped cull winding for !Nanite VSM.
#ROBOMERGE-SOURCE: CL 15347635 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15359404 by brian karis in ue5-main branch]
2021-02-08 15:59:44 -04:00
brian karis
c002e016e3 Spot and point light !nanite VSM support.
#rb ola.olsson

#ROBOMERGE-SOURCE: CL 15341855 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v771-15082668)

[CL 15341864 by brian karis in ue5-main branch]
2021-02-05 16:37:17 -04:00
andrew lauritzen
eb93f3b0c8 Grab bag of virtual shadow fixes:
- Fix SMRT with non-nanite geometry (wasn't sampling the second map)
- Fix toggling distance field shadow cascade on when VSMs are enabled (trying to create a distance field complete shadow map)
  - This is a bit of a questionable case, but at least does not crash now
- Remove dependence of clipmap max distance on shadow cascade distance and replace with a cvar
  - Will likely want to do something similar for far culling distance for non-nanite stuff, but TBD
  - May eventually want a parameter back on the light, but for now just having a cvar set high is good as there is little overhead with Nanite meshes
- Add some debug output for SMRT spot lights

#jira UERNDR-682
#rb brian.karis
#fyi ola.olsson

[CL 15215315 by andrew lauritzen in ue5-main branch]
2021-01-27 01:49:27 -04:00
Brian Karis
c69a8a42cc One pass VSM projection, culled by the light grid.
Major SMRT optimization. Adaptive 7 rays per light with rough penumbra detection. Quality appears to surpass 1rpp with denoising.

#rb andrew.lauritzen

[CL 15190972 by Brian Karis in ue5-main branch]
2021-01-25 18:20:37 -04:00
andrew lauritzen
d45623ceed - Add pass to propogated mapped page information down the page table to enable O(1) lookups of any mapped page at the leaves
- Move some functions in PageManagement.usf to avoid confusing global resource scopes

#rb brian.karis
#fyi ola.olsson

[CL 15169596 by andrew lauritzen in ue5-main branch]
2021-01-22 23:23:16 -04:00
Ola Olsson
75247deb28 Hook up render state recreate to VSM Cvar (r.Shadow.v.Enable)
- needed to handle z-order change in cached render commands.

#rb andrew.lauritzen
#fyi graham.wihlidal

[CL 15162791 by Ola Olsson in ue5-main branch]
2021-01-22 04:59:02 -04:00
andrew lauritzen
a380d97b0e More non-Nanite VSM fixes
#rb graham.wihlidal
#fyi ola.olsson

[CL 15161956 by andrew lauritzen in ue5-main branch]
2021-01-21 23:47:09 -04:00
andrew lauritzen
e0478fe99c - Enable SMRT for spot lights (still a few minor issues but mostly working well)
- Change VSM page table to single packed uint with a field to allow single-lookup to find any mapped MIP
- Page table lookups go through helper function to encode/decode
- Remove some unused shadow emit code

#rb brian.karis
#fyi ola.olsson

[CL 15160590 by andrew lauritzen in ue5-main branch]
2021-01-21 19:15:53 -04:00