* 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]
Add cvar to force full HZB update for debugging
Force invalidation of static pages for any non-movable objects, even if they currently "draw velocity" due to editor movement
- Fixes shadows staying in the original location when dragging static objects in editor
- This is also step 1 to having a more heuristic static/dynamic per-prim split where things can go from one bucket to the other
#preflight 62585cb86e2c50550f07a394
#rb jamie.hayes
[CL 19766198 by andrew lauritzen 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]
- VSM caching now "skips" render calls/frames that did not include any VSM rendering. This allows disabling dynamic shadows or VSMs in scene captures to avoid wiping the cache for the main frame.
#preflight 624b3218323cb7b991431070
#rb graham.wihlidal
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 19614849 via CL 19615203 via CL 19615409
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v938-19570697)
[CL 19616302 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]
- also fix construction of top part of VSM HZB.
#rb rune.stubbe
#robomerge FNNC
#fyi andrew.lauritzen
#preflight 6220a20ad059c6be6c8ca719
[CL 19241653 by Ola Olsson 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]
- Add bHasDeformableMesh to FPrimitiSceneProxy to declare if the meshes are deformed, e.g., skeletal mesh, to be able to catch this case.
- also fix incorrect tracking of revealed primitives (causes invalidation errors with missing shadows when meshes are culled on the CPU).
- Add cvar switch to turn off the new behavior (for emergency use) r.Shadow.Virtual.Cache.DeformableMeshesInvalidate (defaults to 1)
#jira UE-133211
#rb andrew.lauritzen
#preflight 620389584c05b86e6d60185a
#lockdown juan.canada
#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18915487 in //UE5/Release-5.0/... via CL 18920329 via CL 18922688
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v916-18915374)
[CL 18923422 by ola olsson 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]
- Disable view-dependent CPU culling of primitives for local-light VSMs (to fix incorrect caching).
- Track per-light cache data for clipmaps to enable storing bit flags for rendered primitives.
- Make invalidations skip primitives that were never rendered into a clipmap, and mark invalidated primitives as not rendered.
#rb andrew.lauritzen
#preflight 61e6c37b3778a195deabfb8a
#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18639158 in //UE5/Release-5.0/... via CL 18639165 via CL 18639180
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)
[CL 18639190 by ola olsson in ue5-main branch]
Fix warning triggering incorrectly when enabling/disabling VSMs.
Make contact shadow stepoffset the same between VSM and engine contact shadows paths.
#preflight 61b8e845c8566c1582c8255b
#rb ola.olsson
#ROBOMERGE-AUTHOR: andrew.lauritzen
#ROBOMERGE-SOURCE: CL 18467898 in //UE5/Release-5.0/... via CL 18467900
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v899-18417669)
[CL 18467908 by andrew lauritzen in ue5-release-engine-test branch]