Commit Graph

168 Commits

Author SHA1 Message Date
arciel rekman
befab85d25 Fix Hololens rendering (UE-167020).
- Fixed Mobile MultiView (fallback to ISR) stereo rendering on D3D12 (UE-167020).

#rb Rob.Srinivasiah
[REVIEW] [at]Robert.Srinivasiah
#jira UE-167020
#preflight 6357e8230313c249743758ab

[CL 22788314 by arciel rekman in ue5-main branch]
2022-10-26 16:21:13 -04:00
christopher fiala
c38bb5da2c Fixed ViewFamily->FrameNumber not being properly initialized when a new ViewFamily was created for ScreenCapture, solving flickering LOD issues with skeletal meshes in editor and PIE when SceneCaptureComponents are in use. The initialization is now done in SetupViewFamilyForSceneCapture.
#jira UE-161043
#rb arciel.rekman robert.srinivasiah
#preflight 63372a21466fb436691fa156

[CL 22284031 by christopher fiala in ue5-main branch]
2022-09-30 19:18:19 -04:00
wouter dek
735bad5574 Add a separate VSM cache for the views of each SceneCapture component
#jira UE-147440
#rb ola.olsson
#preflight 632821865f55ba280eab0a43

[CL 22072008 by wouter dek in ue5-main branch]
2022-09-19 04:15:20 -04:00
jason hoerner
82d8e99af5 Scene Capture: Use after free bug for SceneRenderer structure, related to stat gathering for new Texture Editor Scene Capture memory display feature. Need to grab view state pointer before calling renderer, which may delete the structure.
#jira none
#rnx
#preflight 63177759ab25bb91f5f7d67d
#rb mihnea.balta

[CL 21821778 by jason hoerner in ue5-main branch]
2022-09-06 13:15:01 -04:00
jamie hayes
d319a6d220 Disable Nanite in planar reflections to prevent issues from not supporting the global clip plane.
#rb graham.wihlidal
#preflight 6310d696ba0b2bb3cf22f10e

[CL 21744634 by jamie hayes in ue5-main branch]
2022-09-01 14:26:57 -04:00
jason hoerner
16c6a37fa6 Scene capture: Lumen support for Scene Capture 2D, Lumen cache resolution adjustment, Texture Editor displays GPU memory usage for Scene Capture 2D
By default Lumen is disabled for Scene Capture to save memory, but can be enabled via post process override settings.  The memory usage display was important when adding this feature, to give feedback to the user of the memory impact for enabling Lumen.  It's also just generally useful besides.  Lumen costs 340 MB to enable if view specific Lumen scene data is enabled at low quality (half resolution page buffer), or 640 MB at high quality (full resolution page buffer).  Besides memory statistics in the Texture Editor, there is an editor specific command which dumps per-resource sizes to log (r.SceneCapture.DumpMemory), useful for investigating where the memory is going.

Lumen requires persistent state to function properly, so Lumen is disabled if bCaptureEveryFrame and bAlwaysPersistRenderingState are both false.  I decided not to allow Lumen for Scene Capture Cube, due to high memory cost, poor CPU performance, and lighting seams across the faces.  I'm hoping in the future to run Scene Capture Cube as a single scene render call (effectively 6-way split screen for the 6 cube map faces), and have certain rendering passes run as a single omnidirectional pass.  Perhaps Lumen could use a single radiance cache for all 6 faces, rather than 6 separate caches, reducing memory, significantly improving performance, and hopefully solving lighting seams.

I rounded out the set of functions that handle per-view VSM and Lumen caches, to include functionality to remove the caches (necessary to allow the per-view Lumen cache to be toggled back off), and query their presence.

#jira UE-148665
#rb Krzysztof.Narkowicz Daniel.Wright zach.bethel
#preflight 6307cf561615ec0db52700e3

[CL 21594503 by jason hoerner in ue5-main branch]
2022-08-26 13:59:08 -04:00
robert srinivasiah
7717a11e22 Remove Omni-Directional Stereo Capture (experimental)
#jira UE-147895
#preflight 630723b7c85b7fef22eccd17
#rb Jeff.Fisher Alejandro.Arango Juan.Canada

[CL 21567260 by robert srinivasiah in ue5-main branch]
2022-08-25 12:50:10 -04:00
christopher waters
e9a48d6897 Removing more uses of GMaxRHIFeatureLevel.
Focus started on GenerateMips and AddClearUAVPass.

#jira none
#rb mihnea.balta
#preflight 62fe768d200ff87e07c5e1ad

[CL 21448320 by christopher waters in ue5-main branch]
2022-08-18 15:29:29 -04:00
zach bethel
bab0b52058 Constrained async uniform expression cache updates to happen during a scene render. This avoids multiple race conditions that can occur due to various material parmeter changes.
#rb jonathan.bard

#ROBOMERGE-AUTHOR: zach.bethel
#ROBOMERGE-SOURCE: CL 21431185 via CL 21431247 via CL 21433716 via CL 21433957 via CL 21434058
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v981-21435820)

[CL 21436491 by zach bethel in ue5-main branch]
2022-08-17 20:34:04 -04:00
graham wihlidal
523081e351 Removed compilation (of never used!) legacy simple forward shading permutations from Windows shader databases (~27% reduction of SM6, ~22% reduction of SM5 when simple forward was enabled in the compiler)
#rb brian.karis, daniel.wright, sebastien.hillaire, charles.derousiers
[FYI] michal.valient, jason.nadro, zousar.shaker
#preflight 62c7654aa6654f9729ea9cc0

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 21010489 via CL 21010513 via CL 21010531
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21023729 by graham wihlidal in ue5-main branch]
2022-07-09 14:02:06 -04:00
zach bethel
d62d286474 Merged PreRender view extension RDG builder with scene render RDG builder.
- Ported remaining ISceneViewExtension calls to RDG.
 - Removed several empty override passes being added to the graph.
 - Merged two graphs into one.

#preflight 62c4c61a2a05d4f55bd5912f
#rb luke.thatcher

[CL 20971717 by zach bethel in ue5-main branch]
2022-07-06 15:33:30 -04:00
Wei Liu
06c9a5c84e 1. Remove all flip-y completely and only flip y at the end on androidl GL with a native window api, no need to handle flip-y on high level.
2. Supports CustomDepth in translucency pass on mobile LDR.

#jira none

#rb Dmitriy.Dyomin
#preflight 62be9894d94b57687c68aed1

[CL 20911586 by Wei Liu in ue5-main branch]
2022-07-01 03:38:17 -04:00
zach bethel
34623f0321 Replaced thread-local MemStack with ConcurrentLinearAllocator across the renderer.
- Removed scene render mem-mark among others. MemStack usage is now restricted to local scopes with known marks.
 - Render resources with destructors are allocated using the FSceneRenderingBulkObjectAllocator on FSceneRenderer, which is deleted when the scene render is.

#preflight 62b266e20d4d6228de97babe
#rb mihnea.balta, yuriy.odonnell

[CL 20907647 by zach bethel in ue5-main branch]
2022-06-30 19:55:24 -04:00
jason hoerner
d15b1426d0 Scene Capture Cube: fix for severe artifacts in volumetric cloud rendering, and possibly other artifacts. The artifacts are caused by the temporal volumetric cloud effect not having a separate history per cube map face.
* Each cube map face gets its own FSceneViewState.  The downside is that it potentially could add a lot of extra memory.  So some memory optimizations were made to compensate.
* Global distance field data is shared for all cube map faces.  This data is only dependent on the view origin, which is invariant for the cube map faces.  A mechanism was added to allow cross view state data sharing for shared origin views.  This saves 8.5 MB, and improves perf.
* Disabled distance field lighting temporal AO for cube map capture.  The AO history texture in the view state is dependent on the Scene texture extents, which is typically the front buffer size, which then gets multiplied by 6.  For a 1080p front buffer, this is 24 MB, while for a 4K front buffer, this is 96 MB, regardless of the resolution of the cube map capture itself.  A 256x256 cube map capture, including all the auxiliary state, is otherwise only around 9 MB, so this is an order of magnitude increase.  A comment in the function "DistanceFieldAOUseHistory" has more details on how this could be fixed, by using the view rect rather than Scene texture extents for the history texture -- for the 256x256 case, it would reduce the incremental memory cost to 768K.

With the memory savings from disabling distance field lighting temporal AO, this change is more or less memory neutral if the Scene texture extent (front buffer) is 1080p.  A net increase of 590K.  With a higher resolution front buffer, it's a subsantial memory win.

#jira UE-151717
#rnx
#rb tiago.costa daniel.wright
#preflight 629f6a27233ae0a8f8f99932

[CL 20614815 by jason hoerner in ue5-main branch]
2022-06-11 19:06:03 -04:00
Andrew Davidson
8d844cd4a6 Improve support for an extended WORLD_MAX
#rb various, trivial
#preflight 62a1cb46f73a01bd981b9978

[CL 20573655 by Andrew Davidson in ue5-main branch]
2022-06-09 07:03:13 -04:00
jason hoerner
6144ebf450 Scene renderer no longer contains multiple view families. Instead, multiple view families are handled by creating multiple scene renderers, which are added to a linked list with the first scene renderer as the list head. This more or less reverses CL 19813996, while preserving the optimizations gained from having knowledge of multiple scene renderers. This includes deferring cross GPU resource transfer waits to the last scene render, running ray tracing scene update once, and only flushing resources once. Future optimizations and bug fixes may take advantage of additional information from other scene renderers.
The refactor to get rid of the FSceneTextures and FSceneTexturesConfig global singletons has also been preserved.  The FViewFamilyInfo is used to hold those structures, so client facing API functions that lack a scene renderer reference can still pull the FSceneTextures[Config] from the view family pointer.  All other scene renderer state has been moved from FViewFamilyInfo back into FSceneRenderer.

#jira none
#rnx
#rb ola.olsson krzysztof.narkowicz zach.bethel
#preflight 629f770e233ae0a8f8fb7f2e

[CL 20540730 by jason hoerner in ue5-main branch]
2022-06-07 13:19:54 -04:00
jason hoerner
00a17f45d1 Scene Capture: Fix for additive / composite blending. Need to skip render target clear when compositing.
#jira UE-151360
#rb mihnea.balta
#preflight 6290b3a9b974ae8eb0391726
#lockdown mihnea.balta

#ROBOMERGE-OWNER: jason.hoerner
#ROBOMERGE-AUTHOR: jason.hoerner
#ROBOMERGE-SOURCE: CL 20391763 in //UE5/Release-5.0/... via CL 20393665
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20398598 by jason hoerner in ue5-main branch]
2022-05-27 16:47:05 -04:00
zach bethel
92d58d2338 Restored FTextureRenderTargetCubeResource to use a staging 2D texture as its render target. Replaced the render target clears with copies from the staging texture which mirrors the old implementation with CopyToResolveTarget. Also fixed another regression in CopyTexture that wasn't part of the unit test.
#rb mihnea.balta, jason.hoerner
#preflight 628f96ab74630984fd3f45d5
#jira UE-151491

[CL 20379819 by zach bethel in ue5-main branch]
2022-05-26 11:24:29 -04:00
zach bethel
3cc87760bd Removed cases of AddCopyToResolveTargetPass which either weren't necessary or weren't performing multisample resolves.
#preflight 628270aa046b81bf93c13e50

[CL 20226032 by zach bethel in ue5-main branch]
2022-05-16 12:09:51 -04:00
jason hoerner
af48ea5a98 UE5_MAIN: Multi-view-family scene renderer refactor, part 2. Move FSceneTextures singleton out of RDG blackboard and FSceneTexturesConfig global variable singleton, into FViewFamilyInfo. This is necessary to allow multiple view families to render in a single render graph and a single scene renderer call.
* Existing calls to CreateSceneTextureShaderParameters and similar functions use "GetSceneTexturesChecked", which allows for the possibility that they are reached in a code path where scene textures haven't been initialized, and nullptr is returned instead of asserting.  The shader parameter setup functions then fill in dummy defaults for that case.  The goal was to precisely match the original behavior, which queried the RDG blackboard, and gracefully handled null if scene textures weren't there.  This definitely appears to occur in FNiagaraGpuComputeDispatch::ProcessPendingTicksFlush, which can be called with a dummy scene with no scene textures.  In the future, I may change this so dummy defaults are filled in for FSceneTextures at construction time, so the structure is never in an uninitialized state, but I would like to set up a test case for the Niagara code path before doing that, and the checks aren't harmful in the meantime.
* I marked as deprecated global functions which query values from FSceneTexturesConfig, but they'll still work with the caveat that if you use multi-view-family rendering, the results will be indeterminate (whatever view family rendered last).  There was only one case outside the scene renderer that accessed the globals (depth clear value), which I removed, noting that there is nowhere in the code where we modify the depth clear value from its global default.  I would like to permanently deprecate or remove these at some point.  Display Cluster is the only code that's currently using the multi-view-family code path, and as a new (still incomplete) feature, third party code can't be using it, and won't be affected.

#jira NONE
#rb chris.kulla zach.bethel mihnea.balta
#preflight 6261aca76119a1a496bd2644

[CL 19873983 by jason hoerner in ue5-main branch]
2022-04-22 17:33:02 -04:00
jason hoerner
b19bb6be2f UE5_MAIN: Multi-view-family scene renderer refactor, part 1. Major structural change to allow scene renderer to accept multiple view families, with otherwise negligible changes in internal behavior.
* 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]
2022-04-19 14:45:26 -04:00
roey borsteinas
ec28b77e5d Explicitly enable 128 bit output on the SceneCapture pixel shader when the platform requires it.
#rb jonathan.bard

#ROBOMERGE-AUTHOR: roey.borsteinas
#ROBOMERGE-SOURCE: CL 19526801 via CL 19526828 via CL 19526845
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v937-19513599)

[CL 19532676 by roey borsteinas in ue5-main branch]
2022-03-28 16:25:48 -04:00
Arciel Rekman
111627d950 Flip HMD extensions to opt-in rather than opt-out
#rb Rob.Srinivasiah, Jonathan.Bard, Jules.Blok
#review @Robert.Srinivasiah
#jira none
#preflight 6238b58f9304d833f4e65e3b

[CL 19472593 by Arciel Rekman in ue5-main branch]
2022-03-22 17:27:12 -04:00
jonathan bard
96f58b74b5 Made sure that view extensions are gathered and that PreRenderView_RenderThread/PreRenderViewFamily_RenderThread and SetupView/SetupViewFamily are called on all of them for all code paths triggering a scene render.
* For thumbnail renderers, the prototype of RenderViewFamily (which is called by all the types of thumbnail renderers) has been changed to take a non-const FSceneView* parameter (so that SetupView can be called on it) and the various GetView functions have been renamed CreateView since it more accurately depicts what the functions do (plus they return the non-const view they've created)
* UGameViewportClient::Draw was calling SetupViewFamily but not SetupView
* Made sure FSceneRenderer::ViewExtensionPreRender_RenderThread is called right before RenderThreadBegin for all code paths
* Made sure view extensions are gathered for all code paths rendering a view family

Note: BeginRenderViewFamily (i.e. game-thread), PostRenderView_RenderThread and PostRenderViewFamily_RenderThread are still not called on the non-standard code paths

#jira UE-140273, UE-140489, UE-139067, UE-140425
#rb sebastien.lussier, rob.srinivasiah
#tests EngineTests (screenshots), editor
#preflight 61fd216ae17efe76d1b49a2d
#lockdown mihnea.balta

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 18884880 in //UE5/Release-5.0/... via CL 18884941 via CL 18885221
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18885607 by jonathan bard in ue5-main branch]
2022-02-07 10:11:19 -05:00
Charles deRousiers
86ece99784 Add rect light texture atlas support.
This changes allow to bind a larger amount of rect. light texture, and allows future support for rect light in forward & cluster passes.

#jira none
#rb sebastien.hillaire
#preflight 61fcebd0b5092d45ad110db4

[CL 18861192 by Charles deRousiers in ue5-main branch]
2022-02-04 04:18:10 -05:00