Commit Graph

135 Commits

Author SHA1 Message Date
Richard Wallis
5ddded329b Fixes for Metal automation tests not running to completion and QA-Materials build lighting crashing.
- ShadingFurnaceTest MainPS() OutColor was returning float3,  need to return float4 when RGBA texture is bound on Metal otherwise we get validation errors.
- DistanceFieldShadowing; Fetch VS not PS.
- MetalRenderTargetTexture Cube resolve; cube copy to array seems to work as intended,  remove asserts to allow this area to be more fully tested.

#jira UE-120222,  UE-149106
#review-20181522 @will.damon, @Sebastien.Hillaire,  @Charles.deRousiers
#rb will.damon,  Sebastien.Hillaire,
#preflight https://horde.devtools.epicgames.com/job/627e6f609650a277337ac706
#rnx

[CL 20221500 by Richard Wallis in ue5-main branch]
2022-05-16 05:37:52 -04:00
zach bethel
16dcf5b313 Refactored Lumen and Distance Field buffers to RDG.
- Replaced FRW{Structured, ByteAddress}Buffer with TRefCountPtr<FRDGPooledBuffer>
 - Replaced ResizeResourceIfNeeded with Resize{Structured, ByteAddress}BufferIfNeeded.
 - Replaced FScatterUploadBuffer with FRDGScatterUploadBuffer.
 - Removed awkward copy of page table buffers now that scatters are on the RDG timeline.
 - Reduced number of uniform buffers created by consolidating within FLumenSceneFrameTemporaries.
 - Fixed up const-correctness of FLumenSceneFrameTemporaries to sanity check that resources were not being mutated later in the frame.
 - Reduced explicit view creations somewhat.
 - Distance fields needs an FDistanceFieldSceneFrameTemporaries to cache RDG resources, but I held off on this due to the number of files it would touch.

#rb krzyzstof.narkowicz, daniel.wright

#ROBOMERGE-AUTHOR: zach.bethel
#ROBOMERGE-SOURCE: CL 19921040 via CL 19922067 via CL 19922607
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 19925590 by zach bethel in ue5-main branch]
2022-04-26 14:37:07 -04:00
tiago costa
d3e0196bd2 Fix error compiling shaders sampling distance fields when using non-default Distance Field Offset Data Structure
- Shaders sampling mesh distance fields must define OFFSET_DATA_STRUCT according to r.DFShadowOffsetDataStructure.
- Also renamed cvar r.DFShadowOffsetDataStructure to r.DistanceFields.OffsetDataStructure since it applies to all techniques sampling mesh distance fields.

#preflight 626661771a71643e8b8b07df
#rb Krzysztof.Narkowicz
#jira none

[CL 19900311 by tiago costa in ue5-main branch]
2022-04-25 07:32:32 -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
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
Sebastien Hillaire
d7d3588b76 Updated confusing name of SLW/SSR/DFShadow tiling data.
#rb none
#preflight none

[CL 19646786 by Sebastien Hillaire in ue5-main branch]
2022-04-06 09:58:52 -04:00
Sebastien Hillaire
6c30a1b32a SLW - DistanceFieldShadow - tiled upsampling pass when water provide data and platform supports it.
#rb kevin.ortegren, tiago.costa
#preflight https://horde.devtools.epicgames.com/job/624d91cea64871f1a11ff6a8

[CL 19646268 by Sebastien Hillaire in ue5-main branch]
2022-04-06 09:25:42 -04:00
Sebastien Hillaire
ab609c73b5 Add support for distance field shadow on water.
Storing water in gbuffer and runnign extra lighting pass would be too expenssiv. So instead, when in deferred, single layer water always output the main dir light luminance into a separate 111110 texture.
DF shadow is applied on that texture. DFShadow culling step is cached the first time for a given view in order to be able to reapply DFShadow later with a depth buffer containing water. This save 0.4ms on a base console.
DFShadow is naturaly skipped if the directional light does not have that feature enabled.
When DFShadow is executed, it is basically 0.24ms extra on a base console @ 1080p.
The separated light buffer is an extra 8MB allocated when in deferred.
This only works with deferred for now (forward does not run the reflection/composite pass).

Render target slot assignement is a bit fuzzy but this is a mostly static setup so should be fine. And could change with Strata down the line.

r.Water.SingleLayer.ShaderSupportDistanceFieldShadow is to enabled dfshadow on water for the shaders. Defaults to 1 and will only be enalbed when using deferred and when distance fields are enabled.
r.Water.SingleLayer.DistanceFieldShadow is a runtime toggle of the feature (if enabled the shaders still output to the separate light render target, but that is simply discarded).

Follow up: tile upsample, tile traceshadow, make it work with strata.

Tested shooter and console.

#rb Tiago.Costa, Kevin.Ortegren
#preflight https://horde.devtools.epicgames.com/job/62457ad79f404234145cd424

[CL 19613312 by Sebastien Hillaire in ue5-main branch]
2022-04-04 15:03:48 -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
tiago costa
f0d44794d6 Fix spot light distance field shadows.
- Translate culling planes from translated-shadow-space to translated-world-space.

#rb none
#preflight 62225fa5335298c31465dd24
#jira none

[CL 19271421 by tiago costa in ue5-main branch]
2022-03-04 13:59:45 -05:00
tiago costa
068d8f5736 DistanceFieldShadows in Translated World Space
#rb none
#preflight 62222f07c33b6ba25d0ab140
#jira none

[CL 19266943 by tiago costa in ue5-main branch]
2022-03-04 11:09:45 -05:00
Charles deRousiers
a02d41c4ee Renamed PROJECT_STRATA into STRATA_ENABLED.
This avoids to define STRATA_ENABLED as 'env. define' for all global shaders needing a Strata specific path.

#rb none
#jira none
#fyi sebastien.hillaire
#preflight 62151b25797dbbeb472ae2eb

[CL 19074999 by Charles deRousiers in ue5-main branch]
2022-02-22 12:35:58 -05:00
daniel wright
ac11b2ceaf Fixed Nanite meshes no longer casting shadows in Lumen Scene in SW tracing mode from cl 18631263
#rb Krzysztof.Narkowicz
[FYI] Ola.Olsson
#jira UE-141207
#preflight 61fc32820a50c2606f266222
#lockdown Michal.Valient

#ROBOMERGE-AUTHOR: daniel.wright
#ROBOMERGE-SOURCE: CL 18850220 in //UE5/Release-5.0/... via CL 18850275 via CL 18850951
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18850991 by daniel wright in ue5-main branch]
2022-02-03 16:10:49 -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
andrew davidson
cac76b118e Fix FVector2D variant casts - Renderer
Submitted on behalf of fred.kimberley
#rb andy.davidson
#preflight 61f8700e41414fb013dd4002

#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 18801433 in //UE5/Release-5.0/... via CL 18802090 via CL 18821511
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18821594 by andrew davidson in ue5-main branch]
2022-02-02 01:43:41 -05:00
krzysztof narkowicz
03f67d112c Lunmen Landscape - added heightfield offscreen shadow culling and set max steps to 32 in order to reach reasonable performance
#preflight 61f7fc90e55232619f8a8d0a
[FYI] Patrick.Kelly

#ROBOMERGE-AUTHOR: krzysztof.narkowicz
#ROBOMERGE-SOURCE: CL 18789747 in //UE5/Release-5.0/... via CL 18789884 via CL 18790241
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18790435 by krzysztof narkowicz in ue5-main branch]
2022-01-31 10:56:14 -05:00
krzysztof narkowicz
0da8f71523 Refactored Distance Field culling
* Removed culled DF object copies during culling. Instead now only indices to culled objects are stored
* Refactored DF heightfield object loads into FHeightfieldObjectBounds and FHeightfieldObjectData

This is a step towards optimizing DF culling and reusing this code for Lumen Landscape culling

Perf Reverb on 2080:
* CullMeshSDFObjectsToFrustum 0.04ms->0.03ms (removed DF object copies)
* Other passes didn't change

#preflight 61f5a7b7694910780bd91918
#rb Tiago.Costa

#ROBOMERGE-AUTHOR: krzysztof.narkowicz
#ROBOMERGE-SOURCE: CL 18789232 in //UE5/Release-5.0/... via CL 18789258 via CL 18789368
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18789821 by krzysztof narkowicz in ue5-main branch]
2022-01-31 10:23:36 -05:00
ola olsson
b5219b04e6 Remove Geometry Shader path for point-light shadow rendering, disable point light shadows if VertexShaderLayer is not supported (at runtime).
- Add r.Shadow.DetectVertexShaderLayerAtRuntime to make it possible to force (for DX11/12/SM5/Vulkan) compilation of vslayer despite RHISupportsVertexShaderLayer being false.
- Set r.Shadow.DetectVertexShaderLayerAtRuntime in WindowsEngine.ini,WinGDKEngine.ini & LinuxEngine.ini.
- Add DoesRuntimeSupportOnePassPointLightShadows to determine support at runtime.
- Fix bug excluding Nanite meshes from DF shadows for local lights if VSM is enabled (now only affects directional lights).
- Add OnGetOnScreenMessages to enable modular generation of on-screen messages in the scene renderer (aimed at transient rendering processes).

#rb arciel.rekman,andrew.lauritzen
#jira UE-138933
#preflight 61f3c967da54035207f6e560

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18769670 in //UE5/Release-5.0/... via CL 18769671 via CL 18769765
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18769767 by ola olsson in ue5-main branch]
2022-01-28 06:36:41 -05:00
andrew davidson
3542cab338 FMatrix explicit cast fixes - Renderer
#rb ben.ingram, zak.middleton
#preflight 61f285e71e5d78c38307cda4

#ROBOMERGE-AUTHOR: andrew.davidson
#ROBOMERGE-SOURCE: CL 18752245 in //UE5/Release-5.0/... via CL 18752267 via CL 18752335
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18752338 by andrew davidson in ue5-main branch]
2022-01-27 07:20:20 -05:00
zak middleton
36c99f6887 #ue5 - LWC: FVector4f <-> FVector4d conversion is now explicit.
FLinearColor has also been modified to make any double->float conversions explicit. Previously all 3D TVector versions were allowed to be implicit and thus could convert TVector<double> => FLinearColor => TVector4<float>.

Fixed up all engine and game casts. Added "//LWC_TODO: precision loss" around any explicit casts that previously were silently explicit and we may need to revisit for precision loss analysis.

#jira UE-122085
#rb Ben.Ingram, Andrew.Davidson
#preflight 61f24af473238441cb7bb0f1

#ROBOMERGE-AUTHOR: zak.middleton
#ROBOMERGE-SOURCE: CL 18751249 in //UE5/Release-5.0/... via CL 18751253 via CL 18751319
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18751326 by zak middleton in ue5-main branch]
2022-01-27 03:30:41 -05:00
ben ingram
d1124c2e41 Move a bunch of lighting calculations to translated world space, fixes various problems at LWC scale
#preflight 61f1760afd5285142b43178a
#rb Daniel.Wright, tiago.costa, Andrew.Lauritzen, charles.derousiers
#jira UE-139831

#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 18738670 in //UE5/Release-5.0/... via CL 18738820 via CL 18739464
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18740039 by ben ingram in ue5-main branch]
2022-01-26 13:56:31 -05:00
Florin Pascu
483c4ca56a Mobile DFS ES31 fix. Sample from SceneDepthTexture and not SceneDepthAux
#rb Dmitriy.Dyomin
#jira none
#preflight 61e6dad37a4131bf358a1bbb

#ROBOMERGE-OWNER: Florin.Pascu
#ROBOMERGE-AUTHOR: florin.pascu
#ROBOMERGE-SOURCE: CL 18640312 in //UE5/Release-5.0/... via CL 18640328 via CL 18640333
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v900-18638592)
#ROBOMERGE-CONFLICT from-shelf

[CL 18640811 by Florin Pascu in ue5-main branch]
2022-01-18 11:19:34 -05:00
ola olsson
b24810ca95 Make DF shadowing skip Nanite meshes if VSM is enabled (Nanite renders into VSM unconditionally causing double shadowing).
- needed for VSM / DF integration

#rb tiago.costa
#preflight 61e51e59a2616066f675d8b0
[FYI] andrew.lauritzen

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 18631263 in //UE5/Release-5.0/... via CL 18631650 via CL 18631674
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)

[CL 18636666 by ola olsson in ue5-main branch]
2022-01-17 23:58:42 -05:00