- 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]
- 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]
- 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]
#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]
- 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]
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]
- 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]
- 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]
- All non-nanite VSM code is wrapped in ENABLE_NON_NANITE_VSM define (on by default if GPUCULL_TODO is on)
- Added FProjectedShadowInfo with setup to gather primitives for clipmap VSM
- Added RenderVirtualShadowMapsHw to FVirtualShadowMapArray to draw into the VSM
- Shadow depth Vertex shader contains logic to route the instances to pages and uses clip distance to clip to page boundary
- Added culling shaders to replicate instances for each overlapped page
#rb rune.stubbe
#fyi graham.wihlidal,brian.karis,andrew.lauritzen
[CL 15144144 by Ola Olsson in ue5-main branch]
- Use engine contact shadow trace function to respect a few tweaks there including the cast contact shadow flag
- Had to stop short of including all the hair/eye-specific stuff as it is very hard-coded currently and not appropriate for general VSM shader...
- Fix self-intersection issues with short contact shadow traces
- Reduce default length of contact shadow trace to reduce artifacts
- Add normal-based offset to shadow lookup positions to reduce issues with projection aliasing and Nanite mesh LOD
- Add small page dilation region to avoid normal offset walking off mapped pages
- Will likely eventually converge some of the sampling logic with SMRT to make it more robust as well, but dilation is a useful feature regardless
- Sample both clipmap levels with SMRT by default as performance of dynamically only sampling one doesn't seem to gain much and some artifacts are avoided.
#review brian.karis
#jira UE-103582
[CL 15031479 by andrew lauritzen in ue5-main branch]
- Disabled by defaul to start. Enable with r.Shadow.v.SMRT.RayCountDirectional 1
- Denoiser will now use temporal reprojection when SMRT is enabled (disable with r.Shadow.v.Denoiser.Temporal 0)
- Variety of fixes and refactors to existing VSM and projection code
- Still a few edge cases that will be improved in future around screen space trace and similar, but working fairly robustly for reasonable light source size settings
#rb ola.olsson
#fyi brian.karis
[CL 14942586 by andrew lauritzen in ue5-main branch]
Two pass occlusion for Non-VSM shadows
Changes shadowmap atlas rendering to render into the border, so we have real data for wide shadowmap filtering kernels. Also improves atlas HZB performance.
#rb ola.olsson
#fyi graham.wihlidal, brian.karis, andrew.lauritzen
[CL 14762582 by Rune Stubbe in ue5-main branch]
- Changed (most) intermediate buffers & textures in FVirtualShadowMapArray to RDG buffers/textures
- Removed GenerateIdentityPageTables as it was no longer working.
- Renamed GeneratePageFlagsFromLightGrid -> BuildPageAllocations to better reflect current function.
#rnx
#rb Andrew.Lauritzen
[CL 14693244 by Ola Olsson in ue5-main branch]