Commit Graph

773 Commits

Author SHA1 Message Date
yuriy odonnell
67fe82da04 Add r.RayTracing.ExcludeSky CVar to control whether sky geometry is added to the ray tracing scene (default: 1, sky is excluded). This allows a project to restore sky behavior to what it was in UE4.
#rb chris.kulla
#jira UE-156820
#preflight 62aa6dee9c7b849bb58ed4ee

#ROBOMERGE-AUTHOR: yuriy.odonnell
#ROBOMERGE-SOURCE: CL 20684387 in //UE5/Release-5.0/... via CL 20684765
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v968-20684695)

[CL 20685289 by yuriy odonnell in ue5-main branch]
2022-06-16 07:20:41 -04:00
jason hoerner
a80801bbba Bug fix: code initializing ray tracing related variables in FDeferredShadingSceneRenderer need to be initialized on render thread, as they access numerous render thread related CVARs...
#jira none
#rnx
#rb Jeremy.Moore
#preflight 62aa343dda0af39a475089db

[CL 20676265 by jason hoerner in ue5-main branch]
2022-06-15 16:10:20 -04:00
jason hoerner
8ff91bee8d Bug fix: ShouldRenderRayTracingEffect can now be called in the game thread as well as the render thread, so it needs to use "GetValueOnAnyThread" for CVAR access.
#jira none
#rnx
#preflight 62aa08a0a4249cd7409b1bb2

[CL 20672488 by jason hoerner in ue5-main branch]
2022-06-15 12:53:09 -04:00
jason hoerner
11e0901224 Multi-view-family render: More robust handling of ray tracing scene update. There is an optimization where we only update the ray tracing scene for the first view family when rendering multiple view families together...
* There was a bug where if the first view family didn't use ray tracing, the ray tracing scene would never be updated.  Now the ray tracing scene is updated on the first view family using ray tracing.  Also cleaned up multiple places we compute "bAnyRayTracingPassEnabled" by moving that flag to FDeferredSceneRenderer.
* There was another bug where view specific light ray tracing RDG buffers were created during the scene renderer that updates the ray tracing scene, potentially leading to those RDG buffers being used outside the graph where they were created.  Now the view specific light buffers are created in each scene renderer.  The code was cleaned up so the buffer creation logic only has access to the static "FSceneView", not any of the transient state in "FViewInfo", to enforce that there are no dependencies on transient state.

#jira none
#rnx
#rb jeremy.moore
#preflight 62a959fc3774a57fdc489013

[CL 20668768 by jason hoerner in ue5-main branch]
2022-06-15 09:08:40 -04:00
Yuriy ODonnell
1aa2ca0782 Move some of the FRayTracingScene initialization work into an asynchronous task
* Add FRayTracingScene::BuildInitializationData, which builds FRayTracingSceneWithGeometryInstances
* Add FRayTracingScene::CreateWithInitializationData() that consumes FRayTracingSceneWithGeometryInstances data
* Run BuildInitializationData() as soon as ray tracing instance culling tasks finish
* Wait for scene initialization data in FDeferredShadingSceneRenderer::DispatchRayTracingWorldUpdates()

This saves ~0.2-0.3ms of rendering thread time in large scenes.

#rb tiago.costa
#preflight 62a93a39012193af3f2f69c7

[CL 20664335 by Yuriy ODonnell in ue5-main branch]
2022-06-14 22:07:35 -04:00
Yuriy ODonnell
1dbadc0952 Fix missing GRHISupportsRayTracingShaders check before initializing HWRT pipelines
#rb none (trivial)
#preflight skip

[CL 20598025 by Yuriy ODonnell in ue5-main branch]
2022-06-10 12:37:51 -04:00
Yuriy ODonnell
9022e2db73 Split HWRT pipeline creation and parameter binding into separate functions. Pipelines can be created during RDG setup and binding will happen later during RDG execution.
#rb aleksander.netzel
#preflight 62a36431ec7332a25c9704e4

[CL 20596616 by Yuriy ODonnell in ue5-main branch]
2022-06-10 11:41:57 -04:00
ola olsson
f5962800b1 Improve overview GPU stats for Nanite and Shadows
- Remove detailed Nanite stat scopes
- and add top level scopes
- make sure Shadow Depths include VSM page allocations

#rb rune.stubbe
#preflight 62a1e1029a3e81e9041423f5

#ROBOMERGE-AUTHOR: ola.olsson
#ROBOMERGE-SOURCE: CL 20574204 via CL 20574230 via CL 20574246
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v954-20466795)

[CL 20575422 by ola olsson in ue5-main branch]
2022-06-09 09:47:03 -04:00
Sebastien Hillaire
fb16f8c1eb Make sure the light debug view is always visible even when nothing request the light grid.
#rb none
#preflight https://horde.devtools.epicgames.com/job/62a1d81cf73a01bd981d72b3

[CL 20574005 by Sebastien Hillaire in ue5-main branch]
2022-06-09 07:47:18 -04:00
jason hoerner
f0d58dfe23 Multi-view-family rendering: Fix for crash when Lumen ray tracing features are enabled. Ray tracing scene resources initialized in the first scene renderer were not being copied to views for other scene renderers / view families. Before CL 20540730, all view families were in the same scene renderer structure, so the loop had been running for views across all families. This fix restores that behavior. I missed the bug in my tests because someone had disabled Lumen in content in the scene I was testing.
#jira UE-156147
#rnx
#rb ola.olsson
#preflight 62a157c7232daff7b3173f42

[CL 20570572 by jason hoerner in ue5-main branch]
2022-06-08 22:36:22 -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
graham wihlidal
d3427e7848 Implemented Nanite GPU stats for total and empty bin counters for raster and shading passes, which includes a bunch of refactoring and cleanup to Nanite stat extraction and printing.
#rb yuriy.odonnell
[FYI] brian.karis, rune.stubbe, jian.ru, ola.olsson, jamie.hayes
#preflight 629eae3958032863432ffeba

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 20532425 via CL 20532434 via CL 20532443
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v954-20466795)

[CL 20532842 by graham wihlidal in ue5-main branch]
2022-06-07 00:48:12 -04:00
tiago costa
5d4c0b9c92 Skip instances part of groups before doing PerInstanceCulling.
- FRayTracingCullPrimitiveInstancesClosure was using the group bounds when culling instances inside a group so those instances were never culled anyway.
- This saves around 0.2ms in CitySample (0.7ms if not using ParallelFor).

#rb yuriy.odonnell
#preflight 629e236b732d8e28401c610c

[CL 20522278 by tiago costa in ue5-main branch]
2022-06-06 12:33:21 -04:00
zach bethel
1fc4c83bd7 Fix for missing view uniform buffer in ray tracing world updates.
#preflight trivial

[CL 20501522 by zach bethel in ue5-main branch]
2022-06-04 14:17:21 -04:00
chris kulla
9d91d7b2c1 Fix a potential crash where deleted primitives could potentially be put into the raytracing mesh command cache even though their resources were already released
This change only refreshes the command cache after having updated all primitive scene infos

#rb Yuriy.ODonnell
#preflight 62993d711941378d7c7c83cb

[CL 20477982 by chris kulla in ue5-main branch]
2022-06-02 18:53:04 -04:00
zach bethel
78b6b40701 Remove view uniform buffer from ray tracing mesh draw commands and delete FPersistentUniformBuffers::ViewUniformBuffer. Deprecated the view uniform buffer from MeshPassRenderState.
#rb yuriy.odonnell
#preflight 629915e62e20b63f9a9d2d46

[CL 20475710 by zach bethel in ue5-main branch]
2022-06-02 16:57:29 -04:00
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