Commit Graph

757 Commits

Author SHA1 Message Date
jeremy moore
925a8fe75c Fix some items rendering to a separate velocity pass when base velocity pass is used with r.SelectiveBasePassOutputs.
This logic took primitives with a material using static lighting and moved velocity writing to a second pass.
Seems like that is some old behavior and after asking around it isn't well known why we had it.
Anyway it's not good to pay the cost of that second pass, so removing that.
#preflight 628fd8f574630984fd4d4464

#ROBOMERGE-AUTHOR: jeremy.moore
#ROBOMERGE-SOURCE: CL 20392160 via CL 20392172 via CL 20392182
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20398501 by jeremy moore in ue5-main branch]
2022-05-27 16:44:41 -04:00
tiago costa
fc62d1fc0e Initial support for deferred decals in path tracer.
- Decals materials are evaluated using callable shaders in PathTracingKernel.
- Decals are culled using a 2D grid similar to the existing light grid.
- In order to correctly handle decal blending order, decals are sorted using the same logic as the rasterizer on CPU. The compute shader that builds the decal grid maintains the correct order.
- Decal materials are wrapped in FRayTracingDecalMaterialShader. The instance parameters of each decal are bound using uniform buffers.

#preflight 628f3fed2f2409bc1e7a6414
#rb Yuriy.ODonnell, chris.kulla, Jeremy.Moore

[CL 20377336 by tiago costa in ue5-main branch]
2022-05-26 05:59:55 -04:00
tiago costa
8da4936663 Support Callable Shaders in FRayTracingScene.
- FRHIRayTracingScene is created with NumCallableShaderSlots.
- Application can add entries to SBT using CallableCommands array.
- ShaderBindings are generated from CallableCommands in BindRayTracingMaterialPipeline(...) once the RTPSO is available so CallableShaderIndex is known.
- Shader Bindings are then merged and set during WaitForRayTracingScene.

#rb yuriy.odonnell
#preflight 628d4053b378b39d419afc4d

[CL 20356249 by tiago costa in ue5-main branch]
2022-05-24 17:27:36 -04:00
Tiantian Xie
f56b463a83 Add warning when the maximum number of active ray tracing lights >= RAY_TRACING_LIGHT_COUNT_MAXIMUM
Promote OnGetOnScreenMessages delegate from private to protected so that all derived renderers from SceneRenderer can add screen messages without modifying the header.

#jira UE-152824
#preflight 628d3a697a34ff0c891f7cac
#rb Tiago.Costa

[CL 20355433 by Tiantian Xie in ue5-main branch]
2022-05-24 16:47:43 -04:00
jason hoerner
0267d53323 DisplayCluster: Virtual Shadow Map cache can optionally be allocated per view, and enabled that feature for Virtual Production. Significant performance win by avoiding constant cache thrashing when rendering multiple families. Frame time goes from ~45 ms to ~26 ms for Valley test scene (Node 2), GPU bound in both cases. Separate cache per view isn't implemented for split screen views (single view family with multiple views), but Virtual Production doesn't use that, and support for that could be added in the future.
#jira UE-142732
#rb andrew.lauritzen ola.olsson
#preflight 628d06a45c3ef99a7b2fffa3

[CL 20351116 by jason hoerner in ue5-main branch]
2022-05-24 13:17:13 -04:00
tiago costa
3def5e7464 Only store RayTracingLightDataUniformBuffer in FViewInfo.
Remove unecessary mutable type qualifiers from FMeshProcessorShaders.

#rb yuriy.odonnell
#preflight 628cf1e17778f10598b1e011

[CL 20349077 by tiago costa in ue5-main branch]
2022-05-24 11:30:18 -04:00
Sebastien Hillaire
d4df05b4b8 Fixed skyatmosphere rendered over opaque meshes already containing fog when in forward.
#rb none
#preflight https://horde.devtools.epicgames.com/job/628cb694f057b981ca525e63

[CL 20346128 by Sebastien Hillaire in ue5-main branch]
2022-05-24 06:59:28 -04:00
tiago costa
afb5cd8ec8 Updated raytracing light culling volume to use RDG.
- Buffers allocated using RDG.
- Use TRDGUniformBufferRef instead of TUniformBufferRef to be able to include SHADER_PARAMETER_RDG_BUFFER_SRV inside the uniform buffer.

#rb yuriy.odonnell
#preflight 628ba79c573a7de2c427c332

[CL 20330573 by tiago costa in ue5-main branch]
2022-05-23 12:34:52 -04:00
aleksander netzel
fa963730c6 Add support for running Lumen HWRT in Vulkan:
* Change LumenVisualize to support inline ray tracing.
* Add BuildLumenHardwareRayTracingMaterialBindings to build bindings when shader pipelines are disabled.
* Pass RayTracingSceneMetadata to all Lumen shaders to be able to reconstruct WorldNormal.
* Fix CardPageLastUsedBuffer to not use GWhiteVertexBufferWithRDG which is not a structured buffer.

#rb yuriy.odonnell, krzysztof.narkowicz
#preflight 6288d03b6f11ac6727a043c9

#ROBOMERGE-AUTHOR: aleksander.netzel
#ROBOMERGE-SOURCE: CL 20321027 via CL 20321048 via CL 20321071
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v948-20297126)

[CL 20322446 by aleksander netzel in ue5-main branch]
2022-05-23 06:36:23 -04:00
daniel wright
096f9eab86 Fix Lumen GI on Volumetric Fog - fog is moved to after the new place that Lumen Translucency Volume GI is calculated as of cl 19855871
#ROBOMERGE-AUTHOR: daniel.wright
#ROBOMERGE-SOURCE: CL 20231807 via CL 20231873 via CL 20231883
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20233549 by daniel wright in ue5-main branch]
2022-05-16 18:12:50 -04:00
Andriy Tylychko
99d1146b0e removed unused global var
#preflight 627cd34e332e182a58197282

[CL 20162401 by Andriy Tylychko in ue5-main branch]
2022-05-12 05:38:53 -04:00
Arciel Rekman
2c4fb2a4eb Fix Nanite culling being broken for the right eye (UE-151478).
- Also added a view event for better UX.
- Also a speculative fix for the non-Nanite instance culling.

#rb Rune.Stubbe, Rob.Srinivasiah
#review @Rune.Stubbe, @Robert.Srinivasiah
#jira UE-151478
#preflight none

[CL 20133378 by Arciel Rekman in ue5-main branch]
2022-05-10 22:27:03 -04:00
zach bethel
1a6dbc061d Deprecated FRDGBufferDesc::EUnderlyingType
#preflight 62756de8d8373707f22a6144
#rb christopher.waters

[CL 20082899 by zach bethel in ue5-main branch]
2022-05-06 15:44:23 -04:00
jason hoerner
0d8f039883 Multi-view multi-gpu, scene rendering perf improvements for Virtual Production.
* Fence wait for cross GPU resource transfers can now be deferred.  Moved the wait for view family render target transfers to the end of all view family rendering.  Saves a few ms GPU in stalls in the Valley project.  The fence wait is marked with a different GPU stat scope, so it can be differentiated from the transfer workload.
* Ray tracing scene update now runs once, for the first view family only.  Saves around 1.2 ms GPU when three views are present.
* Added logic to sort the largest view families to run first, which tend to be the inner frustum, and are usually the bottleneck for the entire frame.  This improves scheduling, saving around 1.0 ms GPU.
* Avoid CPU stalls where Render Thread waits on RHI Thread, by only running "SetFlushResourcesRHI()" on the first view family.  Can save multiple ms when CPU bound.

This is part of ongoing multi-view-family scene render refactor work, where these improvements were made possible by the refactor.

#jira none
#rnx
#rb zach.bethel jason.nadro
#preflight 6272cef4ec1566a7062f20c4

[CL 20059593 by jason hoerner in ue5-main branch]
2022-05-05 12:33:00 -04:00
tiago costa
245b5ce6d5 Don't apply far field offset to CachedRayTracingInstanceWorldBounds.
- raytracing instance culling doesn't apply far field offset to view origin (FRayTracingCullPrimitiveInstancesClosure::operator()).
- also don't need to refresh cached raytracing instances when far field offset changes anymore.

#preflight 6273d7e46a646b1d153e8e7d
#rb Patrick.Kelly

[CL 20057351 by tiago costa in ue5-main branch]
2022-05-05 10:11:00 -04:00
tiago costa
adedecfd54 Support multiple layers in FRayTracingScene.
- Updated places accessing TLAS SRV to use ERayTracingSceneLayer::Base

#rb yuriy.odonnell
#preflight 62728a70ec1566a70616ac9a

[CL 20041705 by tiago costa in ue5-main branch]
2022-05-04 10:41:10 -04:00
Yuriy ODonnell
b26d9c4423 Exclude primitives that are meant to be hidden in game from ray tracing scene when game view is enabled or in PIE mode.
#rb krzysztof.narkowicz
#preflight 62705ebf645c64f3a25dd240

[CL 20041668 by Yuriy ODonnell in ue5-main branch]
2022-05-04 10:37:45 -04:00
Yuriy ODonnell
32ebaf5460 Fix crash when r.RayTracing.Shadows is enabled dynamically
Previously FScene contained an array of RT-shadowed lights which was updated when a light is added/removed.
However, this is incorrect as the light RT shadow state depends on CVars that may be changed dynamically.

The solution is to check if the scene currently contains any RT-shadowed lights during rendering. This is more expensive but robust.
The array of RT-shadowed lights is removed as it was not used beyond checking if it's empty.

#rb juan.canada
#preflight 6271aa653e1f2a9d3a4dd84c

[CL 20041248 by Yuriy ODonnell in ue5-main branch]
2022-05-04 10:05:02 -04:00
zach bethel
94dae5bea0 Ported GPU scene buffers to RDG.
#rb Krysztof.narkowicz
#preflight 627149d0fe09c0cfbc3c7bdd

[CL 20027095 by zach bethel in ue5-main branch]
2022-05-03 12:08:20 -04:00
Arciel Rekman
3dd36a1d5f Share translucency light volume textures between both views of a stereo pair (UE-148569).
#rb Rob.Srinivasiah
#jira UE-148569
#preflight 627143035e6ce673f442a3dc
#review @Robert.Srinivasiah

[CL 20026126 by Arciel Rekman in ue5-main branch]
2022-05-03 11:15:00 -04:00
tiago costa
4d9ee7b667 Support multiple layers in FRHIRayTracingScene.
- Each layer corresponds to a separate TLAS.
- Values returned by FRHIRayTracingScene::GetSizeInfo() are large enough to contain all layers.
- Higher level code can use FRHIRayTracingScene::GetLayerBufferOffset(...) to query the offset of individual layer TLAS when building SRVs.
- Updated FRayTracingSceneInitializer2 so higher level code specifies how many instances are in each layer.

#rb yuriy.odonnell
#preflight 62714094e16e280be60fc35c
#jira none

[CL 20025952 by tiago costa in ue5-main branch]
2022-05-03 11:02:15 -04:00
Juan Canada
00aa934c9d Ray tracing now takes into account the VisibleInSceneCapturesOnly flag
#rb yuriy.odonnell
#jira none
#preflight 62701b408063424f88b06017

[CL 20012394 by Juan Canada in ue5-main branch]
2022-05-02 14:11:04 -04:00
Yuriy ODonnell
57899dad4b Fix ray tracing pipeline initialization when r.RayTracing.Shadows=0 but there is a light in the scene that explicitly enables RT shadows.
#rb Chris.Kulla
#preflight 626ae424a518954d58b66444

[CL 19966704 by Yuriy ODonnell in ue5-main branch]
2022-04-28 15:07:36 -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