- 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]
Fix issues with contact shadow offset in virtual shadow map shader
- Need to ensure we only offset the depth test, not the clipmap level selection or occluder distance computation
#fyi ola.olsson
#rb none
[CL 14206061 by andrew lauritzen in ue5-main branch]
Sampling a virtual shadow map (directional clipmap or spot light) can now be more easily done by:
- Include FVirtualShadowMapProjectionParameters in shader parameter struct
- Call FVirtualShadowMapArray::SetShaderDefines in ModifyCompilationEnvironment
- Set shader parameters via FVirtualShadowMapArray::SetProjectionParameters
- Calling SampleVirtualShadowMapDepth in the shader
#review ola.olsson
[CL 14201665 by andrew lauritzen in ue5-main branch]
- Added LastUpdateSceneFrameNumber to Instance data
- Added GetGPUSceneFrameNumber() to access View.FrameNumber or GPU-Scene specific GPUSceneFrameNumber
- Moved GPUScene class to GPUScene.h
- Moved logic to add/remove instance data to GPU scene to class memebers.
- Added functions in FVirtualShadowMapArrayCacheManagerto invalidate footprints of removed or moved instances before GPU scene update.
- Render to virtual shadow map now invalidates as dynamic the footprint of any cluster that had LastUpdateSceneFrameNumber == GetGPUSceneFrameNumber()
#rb rune.stubbe,andrew.lauritzen
#fyi zach.bethel
[CL 14179043 by Ola Olsson in ue5-main branch]
- Remove virtual shadow cascades path and enable clipmaps instead
- Restore full resolution dense shadow maps even when virtual shadow maps are enabled. Combine dense and virtual shadow maps in the screen space shadow mask during projection.
- Remove "copy to fallback" path for virtual shadows; to be replaced by a separate explicit fallback map or similar. This will break Reverb indirect occlusion with Nanite geometry when virtual shadow maps are on for now. For functional testing, disabling virtual shadow maps will still work.
- Fix a bug with point light shadow projection matrices
- Change VirtualShadowMapId's to "int" since we set them to INDEX_NONE (-1) in a bunch of places
[CL 14156014 by andrew lauritzen in ue5-main branch]
- Corrected offset calculation for hierarchical page flags.
- Improved consistency of hierarchical page flag lookup.
- Light grid build checks the r.Shadow.v.Enable cvar to enable light injection.
#rb andrew.lauritzen
[CL 14134718 by Ola Olsson in ue5-main branch]