* Added "BeginRenderingViewFamilies" render interface call that accepts multiple view families. Original "BeginRenderingViewFamily" falls through to this.
* FSceneRenderer modified to include an array of view families, plus an active view family and the Views for that family.
* Swap ViewFamily to ActiveViewFamily.
* Swap Views array from TArray<FViewInfo> to TArrayView<FViewInfo>, including where the Views array is passed to functions.
* FSceneRenderer iterates over the view families, rendering each one at a time, as separate render graph executions.
* Some frame setup and cleanup logic outside the render graph runs once.
* Moved stateful FSceneRenderer members to FViewFamilyInfo, to preserve existing one-at-a-time view family rendering behavior.
* Display Cluster (Virtual Production) uses new API.
Next step will push everything into one render graph, which requires handling per-family external resources and cleaning up singletons (like FSceneTextures and FSceneTexturesConfig). Once that's done, we'll be in a position to further interleave rendering, properly handle once per frame work, and solve artifacts in various systems.
#jira none
#rnx
#rb zach.bethel
#preflight 625df821b21bb49791d377c9
[CL 19813996 by jason hoerner in ue5-main branch]
- Avoid gotchas with max texture size when static separate enabled
- Simplify addressing logic in a number of places
- Avoid allocating extra HZB that we never use
Details:
- Support rendering/sampling to 2D depth texture array in Nanite and virtual shadow map pass
- Remove some unnecessary HZB-related cvars
- Remove unused permutations from VSM HW raster
#preflight 624f4e5611261bc7b2171208
#rb jamie.hayes
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 19679616 via CL 19679656 via CL 19679706
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v938-19570697)
[CL 19680680 by andrew lauritzen in ue5-main branch]
- Refactor Nanite instance / cluster culling to accommodate VSM HZB tests without blowing out code size.
- Consolidate VSM HZB testing code to one flexible path.
- Always tests against static cached (when static separate is enabled) as this provides the best coverage.
- Currently performs a full HZB rebuild, which is expensive.
#rb rune.stubbe
#fyi andrew.lauritzen
#preflight 62309454e65a7e65d6855209
#robomerge fnnc
[CL 19384824 by Ola Olsson in ue5-main branch]
Reductions *per material*:
SM5
--
FHWRasterizeVS: 832 -> 21
FHWRasterizePS: 104 -> 39
SM6
--
FHWRasterizeVS: 320 -> 9
FHWRasterizeMS: 640 -> 9
FHWRasterizePS: 120 -> 30
Vulkan
--
FHWRasterizeVS: 320 -> 9
FHWRasterizePS: 40 -> 15
Other platforms redacted =)
-- Details
* CLUSTER_PER_PAGE has been fully removed (since we no longer ever run CLUSTER_PER_PAGE=0), which now makes it mutually inclusive with VIRTUAL_TEXTURE_TARGET
* HAS_RASTER_BIN has been replaced with a dynamic branch, since this is just a per cluster index offset based on a simple uniform buffer load
* ADD_CLUSTER_OFFSET has been replaced with a dynamic branch, since this is just a per cluster index offset based on a simple uniform buffer load
* HAS_PREV_DRAW_DATA has been replaced with a dynamic branch, since this is just a per cluster index offset based on a simple uniform buffer load
* NEAR_CLIP (only change to significantly affect codegen) has been turned into a dynamic branch based on FNaniteView - this lets us merge depth clip/clamp rasterizer calls in VSM together instead of relying on HAS_PREV_DRAW_DATA, and a future optimization can now be done to merge local and directional light full Nanite pipeline calls together.
* VISUALIZE permutation removed from VS/MS since it only loaded unform values that passed down per-vertex into fragment stage as nointerpolation parameters. Pixel shader now constructs this uint2 directly under the VISUALIZE permutation
* NANITE_MESH_SHADER_INTERP removed by default but still left in the code, since it is a work in progress potential optimization for DX12 mesh shaders
* Removed explicit Lumen and VSM usage of NANITE_RENDER_FLAG_HAVE_PREV_DRAW_DATA (now the dynamic branch path is only taken if CullRasterizeMultiPass implicitly breaks the rasterization into multiple calls due to NANITE_MAX_VIEWS_PER_CULL_RASTERIZE_PASS overflow)
Performance was tested on a 2080Ti in AncientGame, and the delta is effectively noise (tested cached and uncached VSM). Further testing on other platforms will occur, but important to get this change in for all the benefits and easy to tweak things later if needed.
#rb rune.stubbe
#fyi brian.karis, ola.olsson, andrew.lauritzen, jamie.hayes, daniel.wright, krzysztof.narkowicz
#preflight 622e684c7e2e35638c96a16a
#robomerge FNNC
[CL 19370372 by graham wihlidal in ue5-main branch]
- Shadow PreViewTranslation and ClipmapOrigin become full LWC tile/offset values on the GPU
- In most cases, the camera's and shadow's PreViewTranslations can be subtracted on the GPU to produce a regular-range value to transform from PrimaryView.TranslatedWorld to ShadowView.TranslatedWorld
- Miner cleanup and improvements to SMRT trace loop
- Remove special case for ortho matrices disabling PreViewTranslation in FViewMatrices
- Remove broken static function local and associated cvar r.PreViewTranslation
#preflight 6205dd571404d0fef964d721
#jira UE-139824
#rb graham.wihlidal
#lockdown juan.canada
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18956693 in //UE5/Release-5.0/... via CL 18956877 via CL 18957087
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)
[CL 18958948 by andrew lauritzen in ue5-main branch]
Move visualize enum/defines to shared header file.
Rename a few cvars for consistency.
#rb graham.wihlidal
[FYI] ola.olsson
#preflight 61f9d8921d7ca8ed2d628ccd
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18819821 in //UE5/Release-5.0/... via CL 18819825 via CL 18822904
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)
[CL 18825054 by andrew lauritzen in ue5-main branch]
- Eliminates the additional HPageFlags buffer and associated scalar array indexing in constant buffer
- Unifies addressing logic and helpers (effectively now the addressing is just MipLevel + HMipLevel)
- Small reduction in memory
Move PageFlags and PageRectBounds into the VSM uniform buffer - similar to the page table - to avoid needing to individually funnel them through various interfaces that need to check page overlap
Rename nanitestats VSM_Perspective to VSM_Local for consistency with other cvars
#rb ola.olsson
#preflight 61e5e57ea2616066f68f3453
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18642391 in //UE5/Release-5.0/... via CL 18642432 via CL 18642483
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v900-18638592)
[CL 18642585 by andrew lauritzen in ue5-main branch]
- Factor out the batching setup & merging from the deferred instance culling
- Refactor the instance culling load balancer to be able to share types between different allocators
- Make batching logic use scene rendering allocator
- Rename RenderVirtualShadowMapsHw to RenderVirtualShadowMapsNonNanite (and similar names)
- Refactor view setup logic for Nanite & Non into common functions
#rb andrew.lauritzen
#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18293379 via CL 18373760 via CL 18373855
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18373879 by ola olsson in ue5-release-engine-test branch]
- Add some dither noise to both the SMRT result and the shadow mask lookup to minimize banding
- Fall back to a single sample VSM lookup (with a generous static bias) when overflowing the number of lights in one pass projection path
- Fix clamping issue with page dilation that was setting extraneous pages with point lights
- Fix SMRT issue with local lights jammed right next to geometry viewed at a distance
- Separate settings for page dilation for local and directional lights
- Add simple debug output for # lights in one pass projection
- Remove some dead code/parameters
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18279117 via CL 18373418 via CL 18373449
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18373485 by andrew lauritzen in ue5-release-engine-test branch]
Minor cleanup to logic to try and avoid similar issues
#rb graham.wihlidal
[FYI] ola.olsson
#preflight 6156462e9dc4c50001365202
#lockdown michal.valient
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 17685329 via CL 17967455 via CL 18366106 via CL 18366202
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18366310 by andrew lauritzen in ue5-release-engine-test branch]
- Added stats for non-nanite VSM instance culling (moved VSM stats functionality into own file).
- r.Shadow.Virtual.NonNanite.UseHZB == 2 (default) uses the current-frame Nanite VSM HZB as this enables correct culling for camera cuts & light movement and contains most of the occluding geometry.
#rb Andrew.Lauritzen
#preflight 6138a6582d09b90001568819
#ROBOMERGE-OWNER: jon.nabozny
#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 17470225 via CL 17923040 via CL 18360986 via CL 18361244
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v895-18170469)
[CL 18361409 by jon nabozny in ue5-release-engine-test branch]
This represents UE4/Main @18073326, Release-5.0 @18081140 and Dev-PerfTest @18045971
[CL 18081471 by aurel cordonnier in ue5-release-engine-test branch]
Add static_assert to prevent the creation of new ones moving forward.
Used SHADER_PARAMETER_SCALAR_ARRAY/GET_SCALAR_ARRAY_ELEMENT for single parameters, or packed them with surrounding parameters when possible.
#rb Guillaume.Abadie,Daniel.Wright,Charles.deRousiers
#preflight 61577bf15631d900011d59a1
#ROBOMERGE-AUTHOR: jeannoe.morissette
#ROBOMERGE-SOURCE: CL 17707027 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v879-17706426)
#ROBOMERGE[STARSHIP]: UE5-Release-Engine-Staging Release-5.0
[CL 17707037 by jeannoe morissette in ue5-release-engine-test branch]
- preparational step to enable HZB culling of invalidations in an uniform way.
- also add FComputeShaderUtils helper to set up an indirect dispatch.
#rb andrew.lauritzen
#preflight 6130818017a8610001b0cfc7
#ROBOMERGE-SOURCE: CL 17400532 via CL 17400838
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)
[CL 17400862 by ola olsson in ue5-release-engine-test branch]
Page allocation part is a fairly minor benefit in most scenes but can occasionally make a big difference.
Projection early-out is a pretty uniform benefit all the time, especially with SMRT.
#preflight 612d1b836a14cc000118f03a
#rb ola.olsson
#ROBOMERGE-SOURCE: CL 17388425 via CL 17389280
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)
[CL 17389330 by andrew lauritzen in ue5-release-engine-test branch]