Better labeling for some GPU profiling regions.
Fix to frustum vertex buffer usage flag.
#rb ola.olsson
#ROBOMERGE-SOURCE: CL 16675237
#ROBOMERGE-BOT: (v835-16672529)
[CL 16675244 by andrew lauritzen in ue5-main branch]
- 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]
Should only really affect planet-scale atmospheric sky rendering with shadows onto cloud type cases, which is not the default config.
#rb graham.wihlidal, ola.olsson
#lockdown nick.whiting
#ROBOMERGE-SOURCE: CL 16052384 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v789-15992632)
[CL 16060017 by andrew lauritzen in ue5-main branch]
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]
- 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]
- 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]
- 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]
- 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]
- 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]
- 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]
- Don't bias the "first" clipmap level based on the resolution bias so that the effective "max" resolution at the near clipmap remains the same. There's no right/wrong on this one but this way is likely more intuitive.
#rb none
#fyi ola.olsson
[CL 14602087 by andrew lauritzen in ue5-main branch]
Remove some of the logical asserts as they can trip due to precision in these cases, but it is not a catestrophic error, and the checks were mostly useful when developing the initial logic.
#jira UE-97981
#ROBOMERGE-SOURCE: CL 14271083 in //UE5/Release-5.0-M2/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-M2 -> Main) (v724-14254601)
[CL 14271277 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]