GPULM flagged some errors at runtime due to a mismatch in payload type with respect to the default hit shader. The path tracing default hit shader should be used instead of the raytracing one.
Refactor functions that find default shaders to be independent of the DeferredRenderer and of the View object (since only a ShaderMap is needed)
Make the binding to the miss shader for GPULM explicit since this should also match the right payload type (and we want to eventually deprecate implicit miss shader bindings)
#jira UE-169205
#rb Yujiang.Wang
#preflight 636a872edc30a4ce96a6fce8
[CL 23031241 by chris kulla in ue5-main branch]
This is meant to help avoid inconsistencies between GetRayTracingPayloadType() and the shader code.
As an example of the usage, convert RayTracingDebug related shaders to only enable the payload conditionally. Fix the current incorrect mixing of payload uses in the same shader by introducing a permutation for the material version of the debug shader vs. the one that uses the debug payload (this was previously a runtime shader parameter only which implied two different payloads could theoretically be compiled into one RTPSO).
Also conditionaly enable some of the simpler payload types like the niagara and decal ones that are only used in a few places. Other payloads will be handled in future refactors.
Split RayTracingDebug.usf into smaller files that only have one raytracing entry in them to reduce the amount of counditional logic needed around payloads.
#rb Yuriy.ODonnell
#jira none
#preflight 635c49e9ae6840072d4df82f
[CL 22849513 by chris kulla in ue5-main branch]
This allows the raytracing payload type to vary according to shader permutation parameters which is more flexible and simplifies the code for complex cases like Lumen or deferred reflections
#rb Yuriy.ODonnell
#jira none
#preflight 635a8ba96a2a692f5d720eb3
[CL 22809506 by chris kulla in ue5-main branch]
This persistent atlas hold IES texture in a unique texture array which is used by all systems (raster/RT/PT/Lumen), and unify IES profile rendering.
#rb chris.kulla, sebastien.hillaire, krzysztof.narkowicz
#jira UE-167618
#preflight 6356fd907261e565c436a0fb
[CL 22806455 by Charles deRousiers in ue5-main branch]
Every shader now has the ability to declare which payload it uses. HitGroup, Miss and Callable shaders may only specify a single type, whereas Raygen shaders may provide more than one.
The global raytracing shader libraries have been categorized according to their payload type, which helps facilitate the creation of minimal ray-tracing pipelines.
Avoid adding callable shaders to the RTPSO if they are not being used.
All RHI shader compilers and shader loaders that support ray tracing have been modified to track an extra uint representing the payload type flagged in the source (at time of compilation).
Add the RayTracingPayloadType to the shadermap DDC key so that we can properly detect when a shader's payload type is invalidated. This is required because we serialize the payload type into the shaders from the C++ side.
#rb Yuriy.ODonnell
#jira none
#preflight 635715cae6096564af4dd28e
[CL 22742893 by chris kulla in ue5-main branch]
1. Spatial denoising only plugin.
2. Spatial and temporal denoising plugin.
When the user enables both plugins:
1. The spatial denoising only plugin + builtin temporal denoiser can be selected as (default):
`r.PathTracing.SpatialDenoiser.Type 0`
2. The spatial and temporal denoser plugin can be selected as:
`r.PathTracing.SpatialDenoiser.Type 1`
Note:
* There is a modification in FRDGBuilder::IsTransient() to make TexCreate_Shared return false to make it committed resource. Otherwise, the interop will fail when trying to get the device E_Invalidarg (0x80070057).
#jira UE-158838
#preflight 633f20f72a0a2c1ead3a6184
#rb Juan.Canada, Chris.Kulla
#ushell-cherrypick of 21960393 by Tiantian.Xie
[CL 22405452 by tiantian xie in ue5-main branch]
The assert is due to an architectural bug in RDG where resource transitions for a given resource occur at an arbitrary time in the graph execution, due to batching. The GPU mask can vary, based on which Pass is executing when a transition for a given resource occurs. This leads to the internal state used for validation being inconsistent on one of the GPUs. The hack fix is to make it so the offending resource (PathTracer.LightGrid) only exists on one GPU. This works because the inconsistent transition state happens on a GPU that the resource isn't actually used on, so removing it from that GPU prevents the assert. The RDG transition bug doesn't come up often, because most graphs run all-GPU work first (GPU scene update), then run to termination on a single mask, but GPU Lightmass switches back and forth.
The longer term plan (for 5.2) is to scope ALL resources so they only exist on the GPUs they are needed on, then make it so transitions ignore the active GPU mask, and instead apply transitions for all GPUs where a given resource is present. So there will never be a mismatch in transition state across GPUs. Scoping resources to specific GPUs saves GPU memory and the CPU performance cost of maintaining the resources, so it would be worth doing on its own. And it provides other advantages in terms of improved validation and potential automation of cross GPU transfers through RDG. But this was too big a refactor to do for 5.1, especially with Parallel Rendering work in flight, so I went with the hack fix to avoid the crash.
#jira UE-157789
#rb zach.bethel mihnea.balta
#rnx
#preflight 6339cb1df76de2d4d531462b
[CL 22307467 by jason hoerner in ue5-main branch]
* For single layer water absorbtion/scattering parameters are only known at the surface
* Add a pass to initialize extinction coefficient by shooting an up-ray from camera to hit the water surface.
* Evaluate material and pass extinction coefficient in a buffer for initializing path state's extinction coefficient.
#rb chris.kulla, yuriy.odonnell
#preflight 631f11295b06877acb808871
[CL 21964062 by aleksander netzel in ue5-main branch]
The logic for ShouldCompilePermutation did not exactly match the logic used at runtime, which could lead to the incorrect material being used.
#jira UE-150850
#rb Jason.Nadro
#preflight 631bd95e967ffc68fb38ff44
[CL 21933517 by chris kulla in ue5-main branch]
- This should only be used for gameplay lights.
- Current implementation adjusts light intensity on CPU using exposure data readback from GPU.
#preflight 631b4884d31788ea3a993a2f
#rb Krzysztof.Narkowicz
[CL 21929836 by tiago costa in ue5-main branch]
Fixed include paths to be relative to the private or public folders.
Hid or removed includes that reached into other private module folders.
Updated PublicInclude paths when necessary.
#jira
#preflight 631a717cec45fbf3d74d4ba7
[CL 21916033 by bryan sefcik in ue5-main branch]
* Added "TransferResourceSignal" API to allow signaling that the destination GPU of a cross GPU transfer is done using a given resource, and it's safe for a source GPU to start copying to it. Wanted to get this API level change into 5.1, as it could be used for various MGPU bugs and features going forward.
* Used new API in Path Tracer to fix potential bugs caused by cross GPU copy overlapping with rendering to the destination resource.
* Do multiple passes per frame based on the number of GPUs active, to reduce amortized overhead for cross GPU copies and other frame related work, and avoid situations where performance doesn't increase when rendering is CPU bound. In a purely CPU bound case, performance doubles, while in a GPU bound case, performance increases by 6%.
#jira none
#rnx
#rb chris.kulla jason.nadro mihnea.balta
#preflight 6310ecaae74078cfcdbfba37
[CL 21759166 by jason hoerner in ue5-main branch]
Scoped the root timing block of the scene renderer to all GPUs when the path tracer is active, so child profiling blocks on any GPU can show up (the GPU profiler discards timing intervals where any event in the hierarchy isn't active on a given GPU). Also subdivided the path tracer into more timing blocks, to solve the same issue within the path tracer, and allow multi-GPU work, cross GPU copy, and single-GPU post processing to be differentiated.
#jira NONE
#rnx
#rb chris.kulla
#preflight 630a75c8f92416fb9238cec0
[CL 21685581 by jason hoerner in ue5-main branch]
Focus started on GenerateMips and AddClearUAVPass.
#jira none
#rb mihnea.balta
#preflight 62fe768d200ff87e07c5e1ad
[CL 21448320 by christopher waters in ue5-main branch]
#jira UE-107027
#rb Yuriy.ODonnell
Extend the recently added raytraced light function support to the path tracer. Unlike in Ray Tracing which must retain visual compatibility with the deferred renderer, the path tracing implementation supports colored light functions.
Also guard the logic for miss shaders in DeferredRendering to avoid issues on platforms that support ray tracing but not ray tracing shaders yet (Vulkan).
#preflight 62c500bb2a05d4f55be9ff6b
[CL 20957938 by chris kulla in ue5-main branch]
- Ray tracing decal grid is only created (CreateRayTracingDecalData(...)) if ShouldPrepareRayTracingDecals().
- ShouldPrepareRayTracingDecals() checks whether runtime supports the feature, there's decals in the scene, and any technique actually uses decals (currently only PathTracing).
- Added bHasRayTracingDecals to FViewInfo since RayTracingDecalUniformBuffer always has a valid uniform buffer (but might not contain any decals).
- Techniques check bHasRayTracingDecals decide whether to use permutations that use decals.
#rb chris.kulla
#preflight 62b5f3527c36e1309759a17e
[CL 20813032 by tiago costa in ue5-main branch]
Basic algorithm:
Estimate the pixel correspondences (motion vectors) to the previous frame where their local patches match the best using non-local means. Then history is combined with the current frame with a temporal low pass filter (exponential moving average & temporal bilaterial filtering). To better control the parameters, we use perception error DeltaE2000. Pixel difference larger than 10 dE is rejected for detail preserving.
How to enable:
Add `r.PathTracing.TemporalDenoiser 1` in MRQ console variables when path tracing denoising is enabled in postprocess volume.
#jira UE-136319
#rb chris.kulla
#preflight 62aa28dca40a4dc3a0412e2f
[CL 20675469 by Tiantian Xie in ue5-main branch]
- 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]