Commit Graph

23 Commits

Author SHA1 Message Date
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
andrew lauritzen
ed544ba28f Disable adaptive ray count projection shader when wave ops are not supported on a given RHI.
#rb trivial
[FYI] brian.karis

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

[CL 15370549 by andrew lauritzen in ue5-main branch]
2021-02-09 17:01:35 -04:00
andrew lauritzen
7726f54957 Point light SMRT:
- Implement cube map SMRT using iteration across two faces. While a ray can technically span 3, no significant corner-related artifacts were observed.
- Rafactor SMRT loop out to a macro/include-based quasi "template" and reimplement SMRT for all light types in terms of it
- Few bug fixes and improvements to occluder distance approximation and similar

#rb brian.karis, ola.olsson

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

[CL 15341176 by andrew lauritzen in ue5-main branch]
2021-02-05 15:55:43 -04:00
andrew lauritzen
69450b4f7c Only add wave ops CFLAG to the relevant permutation.
- DX11 now at least works if you disable r.Shadow.v.SMRT.AdaptiveRayCount

#rb trivial

[CL 15258148 by andrew lauritzen in ue5-main branch]
2021-01-28 22:04:53 -04:00
andrew lauritzen
ac53e341d9 Avoid compiling adaptive SMRT ray count (wave ops) in pixel shader projections.
Add cvar to enable/disable adaptive SMRT ray count.

#rb graham.wihlidal
#jira UE-107199

[CL 15229927 by andrew lauritzen in ue5-main branch]
2021-01-27 21:04:55 -04:00
Florin Pascu
c26c53b3bd Fix Shader Compile Mobile
#rb Ola.Olsson
#jira none
#fyi Brian.Karis

[CL 15206812 by Florin Pascu in ue5-main branch]
2021-01-26 08:59:57 -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
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
Brian Karis
baed699817 Point light VSM
#rb andrew.lauritzen

[CL 15133841 by Brian Karis in ue5-main branch]
2021-01-18 22:44:41 -04:00
andrew lauritzen
a232437893 Fix/reverb some debug code in VSM projection.
Reduce default normal offset as it is removing too many fine grained shadows in Reverb.

#rb trivial
#fyi brian.karis

[CL 15100028 by andrew lauritzen in ue5-main branch]
2021-01-14 20:00:54 -04:00
andrew lauritzen
43ac742379 Fix/improve a variety of VSM artifacts:
- 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]
2021-01-08 22:26:52 -04:00
andrew lauritzen
fb0b1d790b Initial shadow map ray tracing support for directional lights
- 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]
2020-12-16 17:57:13 -04:00
Ola Olsson
a9b6b0e0a8 Refactor virtual shadow maps to remove needless extract and register external of RDG resources.
- 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]
2020-11-09 15:47:39 -04:00
zach bethel
e0180dfe27 Fixed RDG uniform buffer usage in shadows.
#rb andrew.lauritzen
#rnx

[CL 14669826 by zach bethel in ue5-main branch]
2020-11-05 16:28:34 -04:00
Marcus Wassmer
3b81cf8201 Merging using //UE5/Main_to_//UE5/Release-Engine-Staging @14384769
autoresolved files
#rb none

[CL 14384911 by Marcus Wassmer in ue5-main branch]
2020-09-24 00:43:27 -04:00
andrew lauritzen
fa0a428cb1 Rename virtual shadow map sampling parameters structure.
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]
2020-08-27 20:31:32 -04:00
andrew lauritzen
5014926a72 Shadow projection shader refactoring.
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]
2020-08-27 14:20:18 -04:00
andrew lauritzen
f56c73960d Various nanite and virtual shadow refactoring:
- 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]
2020-08-20 14:06:29 -04:00
graham wihlidal
2f504476a0 Fixed remaining cases where Nanite/VSMs shouldn't be compiled on certain platforms (including Metal/Vulkan)
#rb none
#fyi brandon.schaefer, josh.adams, ola.olsson

[CL 14145867 by graham wihlidal in ue5-main branch]
2020-08-19 14:22:37 -04:00
Ola Olsson
90810d2428 Refactored ShadowProjectionData to not have any view dependence
- simple matter of moving out view.PreTranslation handling

#rb andrew.lauritzen

[CL 14145303 by Ola Olsson in ue5-main branch]
2020-08-19 12:54:43 -04:00
Michal Valient
95d19f95b1 [REVERB] Merging //UE4/Private-Reverb-Development@13832732
#rb graham.wihlidal, rune.stubbe, brian.karis, andrew.lauritzen, jeff.farris

[CL 13834854 by Michal Valient in ue5-main branch]
2020-07-06 18:58:26 -04:00