Commit Graph

341 Commits

Author SHA1 Message Date
andrew lauritzen
f8032f4743 Optimizations to light loop for shadowed lights:
- Move translucent injection outside the loop rather as it shares state and doesn't need barriers between it. This had already been done for unshadowed lights but this implements it for shadowed lights as well.
- Implement VSM one pass projection (still default off) even when clustered shading is not enabled. Has two paths in the regular light loop:
  1) If another effect (ex. light functions) needs to interact with the screen shadow mask, a VSM composite path is inserted that does a quick copy from the one pass projection shadow mask bits
  2) If only VSM is needed for the light, the lookup is rolled directly into the deferred lighting pixel shader, eliding the screen shadow mask entirely
Especially in the second case this significantly cuts down on GPU idle time and g-buffer bandwidth, improving the performance of scenes with small local lights

#rb ola.olsson, charles.derousiers
#preflight 633b36f9ba39998ce84c34dd
#jira UE-122099

[CL 22327084 by andrew lauritzen in ue5-main branch]
2022-10-04 01:25:53 -04:00
mickael gilabert
6d8989352d Rolled back 21899912 and integrated pieces of 20806454 to properly fix distance field shadow + CSM in forward in mobile renderer
[REVIEW] [at]wei.liu
#rnx

[CL 21989570 by mickael gilabert in ue5-main branch]
2022-09-13 15:02:31 -04:00
mickael gilabert
8196da39e7 Fix channel write mask renderstate not properly set when resolving mobile shadow projection in forward with distance field enabled
[REVIEW] [at]dmitriy.dyomin, [at]pete.sauerbrei
#rnx

[CL 21910566 by mickael gilabert in ue5-main branch]
2022-09-08 21:30:54 -04:00
brant french
de5a9eb9fb Manually merging this into main from 21.50. Ran into conflict merging.
Added more draw call catregories to stat drawcount to account for some major drawcalls that are being missed.
[REVIEW] [at]Andrew.Ladenberger, [at]Stu.McKenna, [at]Mickael.Gilabert
[FYI] [at]Bryce.Lumpkin
#RNX
#RB Stu McKenna

#ROBOMERGE-OWNER: brant.french
#ROBOMERGE-AUTHOR: brant.french
#ROBOMERGE-SOURCE: CL 21324342 via CL 21326795 via CL 21327209 via CL 21327371
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21329348 by brant french in ue5-main branch]
2022-08-10 19:07:04 -04:00
Arciel Rekman
4085b834b2 Fix shadow rendering with multiviewport (UE-157530)
#rb Rob.Srinivasiah
#jira UE-157530
#review @Robert.Srinivasiah, @Jules.Blok
#preflight none

[CL 21224055 by Arciel Rekman in ue5-main branch]
2022-07-22 13:08:31 -04:00
Arciel Rekman
09175d79ea Multi-viewport on PC (D3D11/12, Vulkan).
- RHISupportsMultiviewport made to work on relevant shader platforms.
- RHISetStereoViewport implemented
- Unused outputs removal fixed to always consider viewport index used.
- Renamed confusing terminology (multiview -> multiviewport).
- Added a CVar (vr.MultiViewport) to force disable
- Added a canvas output to know the method in non-Shipping

#jira UE-151349
#review @Robert.Srinivasiah, @Jules.Blok, @JeanNoe.Morissette
#rb Robert.Srinivasiah, Jules.Blok, Chris.Waters
#preflight 62d193c43b057e727491c9d2

[CL 21153050 by Arciel Rekman in ue5-main branch]
2022-07-18 17:31:15 -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
Arciel Rekman
442b2ecf5c Fix translucency artifacts in VR (UE-155157)
#jira UE-155157
#rb Rob.Srinivasiah
#review @Robert.Srinivasiah
#preflight none

[CL 20811769 by Arciel Rekman in ue5-main branch]
2022-06-24 13:05:22 -04:00
Robb Surridge
0a5a02c5b2 Coding standard fixes: gender-inclusive language
#jira UE-156429
#preflight 62b32e826a25ba6ae52f94bd
#rb jason.walter

[CL 20795375 by Robb Surridge in ue5-main branch]
2022-06-23 11:14:07 -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
Arciel Rekman
f43f655d5a Fix distance field shadows artifacts in the right eye (UE-150939).
#rb Rob.Srinivasiah
#jira UE-150939
#review @Robert.Srinivasiah
#preflight

[CL 20030333 by Arciel Rekman in ue5-main branch]
2022-05-03 15:14:11 -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
Wei Liu
2be82d909c Fix a bug of depthAux corruption on mobile opengl.
#jira UE-145101

#rb Dmitriy.Dyomin
#preflight 62629916d929bc34a3269fb2

[CL 19863137 by Wei Liu in ue5-main branch]
2022-04-22 08:07:57 -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
Wei Liu
04d7580d62 Clustered local lights and reflections are supported on mobile forward and deferred.
Local light shadows are supported on mobile forward and deferred, need to enable full depth prepass to generate the ShadowMaskTexture.

Remove the 4 maximum local lights limitation on mobile forward.

Remove the "High Quality Reflection" on mobile forward.

Disable simple lights on mobile forward.

#jira UE-149064

#rb Dmitriy.Dyomin

#preflight 625d17da772cf82d3a6059a6

[CL 19784597 by Wei Liu in ue5-main branch]
2022-04-18 09:09:40 -04:00
Arciel Rekman
700c39e0e7 Fix VSM debug view being the same for the right eye.
#rb Andrew.Lauritzen
#review @Andrew.Lauritzen, @Robert.Srinivasiah, @Jules.Blok
#jira none
#preflight 625642c45f20a0a34d8fbaf7

[CL 19734289 by Arciel Rekman in ue5-main branch]
2022-04-12 23:44:41 -04:00
tiago costa
e90e058b9f Fix DF Shadows when using split screen.
- Point/Spot lights use the same FProjectedShadowInfo for all views. RayTracedShadowsTexture was only generated for the first view. Other views also sampled first view data.
- Store RayTracedShadowsTexture per view in DistanceFieldShadowViewGPUData to avoid using the cached result of a different view.

#rb Sebastien.Hillaire, Jian.Ru
#preflight 624ef87e3603402d600744e1

[CL 19669626 by tiago costa in ue5-main branch]
2022-04-07 11:06:06 -04:00
tiago costa
ba8dba2bcd Don't use async compute when calculating DF Shadow for water.
#rb Sebastien.Hillaire
#preflight 624ed3907d2eea4e1804ece4

[CL 19667178 by tiago costa in ue5-main branch]
2022-04-07 08:21:45 -04:00
zach bethel
a00b40ad3b Deprecated GetRenderTargetItem() from IPooledRenderTarget.
#preflight 624ddb30090236773a1a83e0
#rb luke.thatcher

#ROBOMERGE-AUTHOR: zach.bethel
#ROBOMERGE-SOURCE: CL 19655641 via CL 19655653 via CL 19655661
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v938-19570697)

[CL 19657582 by zach bethel in ue5-main branch]
2022-04-06 18:24:24 -04:00
Charles deRousiers
61cf50b66f Change Strata binding buffer function args to take view instead of the explicit scene data.
#rb none
#jira none
#preflight 6246ee2a292f228e0914eed2
#fyi sebastien.hillaire

[CL 19586823 by Charles deRousiers in ue5-main branch]
2022-04-01 08:35:55 -04:00
Sebastien Hillaire
fe62a6a8c3 Fix for strata crash when disabled.
Backout a file from 19415778.
#rb ola.olsson
#preflight none
#fyi wei.liu

[CL 19418567 by Sebastien Hillaire in ue5-main branch]
2022-03-17 06:17:38 -04:00
Wei Liu
d3e9fe947c Initialize Strata on mobile to fix crashes on mobile.
#jira none

#rb Dmitriy.Dyomin, Sebastien.Hillaire
#preflight 6232808aef5d0f0e8ffcbf37

[CL 19415778 by Wei Liu in ue5-main branch]
2022-03-16 20:43:06 -04:00
arciel rekman
f6ccaa9567 Fix shadow artifacts in the right eye (UE-136749).
#rb Jules Blok, Yuriy O'Donnell
[REVIEW] [at]Jules.Blok, [at]Yuriy.ODonnell
#jira UE-136749
#preflight 62184a6248518fd8cbea663b

#ROBOMERGE-AUTHOR: arciel.rekman
#ROBOMERGE-SOURCE: CL 19142586 in //UE5/Release-5.0/... via CL 19142695
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19156111 by arciel rekman in ue5-main branch]
2022-02-25 16:00:41 -05:00
Charles deRousiers
84c1cb7302 Fix local lighting with strata.
#jira none
#rb none
#fyi sebastien.hillaire
#preflight 62068b6ec663666c89a5cb0f

[CL 18953624 by Charles deRousiers in ue5-main branch]
2022-02-11 11:38:18 -05:00
fred kimberley
7fbfaf57c8 Require explicit constructors/casts when converting between FVector, FVector3d, and FVector3f.
#jira UE-122078
#rb Andrew.Davidson, Colin.McGinley
#preflight standard build

#ROBOMERGE-AUTHOR: fred.kimberley
#ROBOMERGE-SOURCE: CL 18817999 in //UE5/Release-5.0/... via CL 18818012 via CL 18822871
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18824721 by fred kimberley in ue5-main branch]
2022-02-02 07:59:31 -05:00