Commit Graph

87 Commits

Author SHA1 Message Date
aurel cordonnier
d17d20ca36 Merge from Release-Engine-Test @ 16758890 to UE5/Main
This represents UE4/Main @ 16738161 and Dev-PerfTest @ 16737719 (and Release-17.00 @ 16658211)

[CL 16763350 by aurel cordonnier in ue5-main branch]
2021-06-23 17:51:32 -04:00
chris kulla
f1b32af777 Restore changes to PathTracing code caused by the last engine merge
#rb Aurel.Cordonnier

[CL 16635840 by chris kulla in ue5-main branch]
2021-06-10 23:00:24 -04:00
aurel cordonnier
e0ad4e25df Merge from Release-Engine-Test @ 16624776 to UE5/Main
This represents UE4/Main @ 16579691 and Dev-PerfTest @ 16579576

[CL 16625248 by aurel cordonnier in ue5-main branch]
2021-06-10 13:13:24 -04:00
chris kulla
148b80ad02 Expose current path tracer sample index to be able to retrieve path tracer progression
Avoid incrementing the path tracer sample and frame index when not accumulating samples

#rb Lucas.Ammann
#preflight 60b9296239e5b70001d02463

[CL 16553724 by chris kulla in ue5-main branch]
2021-06-03 17:33:02 -04:00
chris kulla
b7721dec78 Enable Path Tracing denoiser by default
Expose a checkbox on PostProcessVolume to control the path tracing denoiser.

Fix the hard clamp on samples/pixel since we don't have any internal limit. A UI clamp is sufficient.

Store the denoiser state in the path tracer config object so it does not get confused per View.

#rb Patrick.Kelly, Juan.Canada
#preflight 60b679deae46a100012ff351

[CL 16520779 by chris kulla in ue5-main branch]
2021-06-01 15:39:11 -04:00
chris kulla
ea2bf93387 Add OpenImageDenoise plugin for path tracer
This plugin implements a denoiser for path traced images using the OpenImageDenoise library. The denoiser is enabled by both loading the plugin and setting r.PathTracing.Denoiser=1

Add Albedo/Normal outputs to the path tracer to support the denoiser.

#rb Patrick.Kelly
#jira UE-79847

#robomerge[STARSHIP] -Starship-RES

#ushell-cherrypick of 16455905 by chris.kulla

[CL 16485986 by chris kulla in ue5-main branch]
2021-05-27 11:45:57 -04:00
will damon
38c0275dca Make the r.PathTracing cvar available to all editor configurations.
- Fixes cooking on platforms lacking hardware ray tracing.

#rb chris.kulla
#jira none
#rnx

[CL 16422132 by will damon in ue5-main branch]
2021-05-21 14:37:19 -04:00
chris kulla
70ac232696 Add Path Tracer specific material permutation
This permutation will allow the path tracer to evolve independently from other RT passes in the engine. First end-user visible feature is that we disable RayTracingQualitySwitch for this permutation (so that path tracing can see the "full" material quality).

Introduce r.PathTracing cvar to guard the feature so that projects that don't need this functionality don't have to pay for the extra permutation.

Move raytracing clip/ddx/ddy into Common.ush
#jira UE-72537

#rb Patrick.Kelly, Yuriy.ODonnell
#preflight 60a7339365d94d0001bce99d

[CL 16415068 by chris kulla in ue5-main branch]
2021-05-21 01:00:49 -04:00
chris kulla
d064996317 Improve path tracer performance with simplified materials
GPU Lightmass saw a performance regression after using more of the material model for translucent shadow support. Reclaim some performance by special casing more of the material logic for the subset that GPULM needs.

#rb Yujiang.Wang
#preflight 609ad275ab726700013a472c

[CL 16278525 by chris kulla in ue5-main branch]
2021-05-11 15:46:27 -04:00
chris kulla
6df4146582 Make sure we pick the no-lightmap shader permutation when using the path tracer
This is another small step towards enabling path tracing specific shader permutations.

This requires re-caching the raytracing mesh commands when we flip to and from path traced rendering.

Cleanup some flag handling by removing the redundant ERayTracingRenderMode enum since it is already capture by show flags.

Avoid checking the path tracing flag per view since it is always common to all views

Re-introduce the deduplication over views for the non-path tracing case since ray tracing effects can be enabled in a view dependent fashion.

Rename CanOverlayRayTracingOutput to HasRayTracedOverlay which I think is a bit clearer. Note that the meaning has flipped - it now returns true when path tracing or ray tracing debug modes are enabled.

Remove leftovers of GAveragePathTracedMRays (which wasn't hooked up to anything anymore)

Refactor static variables used to store path tracing state into a pimpl object off of the ViewState

#rb Patrick.Kelly, Yuriy.ODonnell, Juan.Canada

[CL 16249998 by chris kulla in ue5-main branch]
2021-05-10 12:22:42 -04:00
Andrew Davidson
3ddc3a4da3 Merge up from //UE5/Dev-LargeWorldCoordinates
#rb none

[CL 16211417 by Andrew Davidson in ue5-main branch]
2021-05-05 15:07:25 -04:00
aurel cordonnier
50944fd712 Merge UE5/RES @ 16162155 to UE5/Main
This represents UE4/Main @ 16130047 and Dev-PerfTest @ 16126156

[CL 16163576 by aurel cordonnier in ue5-main branch]
2021-04-29 19:32:06 -04:00
chris kulla
202c92ba47 Unify RT Skylight with Path Tracer implementation
Use the path tracer's skydome implementation for RT skylight, replacing the previous cubemap based implementation. The caching of the skydome texure and pdf is now done in a central location, which allows RT skylight, RT GI and the path tracer to share the same map. For static cases (captured sky or explicit cubemap) this work is only done once and re-used. For realtime capture cases (sky/atmosphere system), this work can happen each time the sky is updated (previously this case did not support RT skylight at all).

#rb Patrick.Kelly

[CL 16115098 by chris kulla in ue5-main branch]
2021-04-26 12:05:18 -04:00
chris kulla
e91214d316 Refactor path tracer skylight code so it can be shared with RTGI
This allows us to drop the older sampling code from the path tracer implementation.

#rb Patrick.Kelly

[CL 16063735 by chris kulla in ue5-main branch]
2021-04-20 14:02:27 -04:00
chris kulla
9664d55826 Add MaxPathExposure to PPV to control path tracer clamping
The maximum path intensity is normally relative to the overall exposure. Since the path tracer accumulates accross frames we cannot tie the clamp to the exposure as it would lead to inconsistent results when interactively adjusting exposure during rendering (or create a strange feedback loop with eye adaptation).

Improve the path tracer setting tooltips in PPV a bit.

Minor cleanups to cvar descriptions, comment out unused cvars.

Cleaner empty buffer handling for LightGridData

Avoid redundant allocation and copy when uploading path tracer lights

#rb Juan.Canada

[CL 16051929 by chris kulla in ue5-main branch]
2021-04-19 12:31:13 -04:00
chris kulla
ec009af823 Path Tracing setting cleanups
Add PPV flag to enable path traced emissive materials (on by default). These paths are not always needed if there are lots of tiny emitters, or if the scene was modelled with both emissive geometry and lights.

Change Skip* variables to Enable* to be more intuitive

Turn the sampler options into a proper enum since they were intended to be mutually exclusive

Tweak MaxPathIntensity logic to match Lumen and avoid color shifts

#rb Juan.Canada
#preflight 6079ba3dd400b70001571289

[CL 16036532 by chris kulla in ue5-main branch]
2021-04-16 13:23:59 -04:00
chris kulla
a42b669d3c Add light culling for path tracer
Split the light list info finite (point, spot, rect) and infinite (skydome, directional) sets. Build a 2d grid of which finite lights overlap particular regions. The grid is aligned to the bounding box of all lights and collapsed along the shortext axis so that memory usage scales quadratically with resolution instead of cubically. The light list per cell is currently pre-allocated up to a maximum count per cell (overflow is simply cut and lights are dropped as they were prior to this change). In most scenes I have tried so far this maximum is never reached with the current defaults of 256^2 resolution and 128 max lights per cluster.

#rb Patrick.Kelly
#preflight 60785d289e2d7a00016e3032

[CL 16022731 by chris kulla in ue5-main branch]
2021-04-15 12:22:28 -04:00
yujiang wang
81c4919eb3 GPULM: Port new SkyDome implementation for LightmapPathTracer
#rb chris.kulla

#ROBOMERGE-OWNER: chris.kulla
#ROBOMERGE-AUTHOR: yujiang.wang
#ROBOMERGE-COMMAND: _robomerge UE5-Main
#ROBOMERGE-SOURCE: CL 15945398 in //UE4/Main/... via CL 15993208
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Main) (v789-15992632)

[CL 16013875 by yujiang wang in ue5-main branch]
2021-04-14 19:17:03 -04:00
chris kulla
02554bde35 Improve approximate caustics in path tracer
Use per lobe roughness instead of assigning a global roughness to all rays. This preserves reflected highlights better off of multi-lobed materials like dielectrics that have both a diffuse and specular lobe.

Add cvar to skip emissive shaders

This can be useful to debug noise coming from small emissive surfaces in the scene, or to deal with scenes that have both lights and modelled emitters.

Tweak transmission color to keep overall albedo under 1

Some assets with the twosided foliage or subsurface shading models have albedo over 1. Try to compensate for this by darkening both colors.

Fix potential bug with MIS weight calculation

#rb Patrick.Kelly

[CL 15855212 by chris kulla in ue5-main branch]
2021-03-29 16:47:02 -04:00
chris kulla
ce17840274 Add option for Coherent path tracing
When enabled, shuffle pixel coordinate and share random number streams to improve the coherence of execution. This can provide large speedups (2x or more) on some scenes, and even modest speedups on complex scenes (30% or so). However it comes at the price of somewhat distracting artifacts at low sample counts that may be objectionable.

Leaving this disabled by default for now to gather feedback.

#rb Juan.Canada

[CL 15825443 by chris kulla in ue5-main branch]
2021-03-25 12:31:49 -04:00
Yuriy ODonnell
4a29acca6f Implemented explicit memory management for D3D12 ray tracing acceleration structures.
If FRayTracingSceneInitializer.bExplicitMemoryManagement is true, the RHI will no longer internally allocate the TLAS buffer or SRV.
These should instead be explicitly created using regular RHICreateBuffer and RHICreateShaderResourceView APIs.
Buffer must be then bound to the scene using RHICmdList.BindAccelerationStructureMemory() before TLAS is built or any other GPU work is done.

#rb zach.bethel

[CL 15814201 by Yuriy ODonnell in ue5-main branch]
2021-03-24 21:13:13 -04:00
Yuriy ODonnell
786d291360 Create ray tracing scene on a task. Reduces the Render Thread critical path time.
#rb Juan.Canada

[CL 15775714 by Yuriy ODonnell in ue5-main branch]
2021-03-23 09:21:56 -04:00
Yuriy ODonnell
7f11375a15 Added bSupportsPathTracing bit to DDPI, which is only set on Windows.
[CL 15756488 by Yuriy ODonnell in ue5-main branch]
2021-03-21 15:55:43 -04:00
chris kulla
8387c26d2b Texture support for Rect lights in the path tracer
This patch just adds the basic support for evaluating the texture, it is not taken into account in the importance sampling. Also, currently limited to 8 slots like the RT path until we get proper bindless support.

#rb Patrick.Kelly

[CL 15751254 by chris kulla in ue5-main branch]
2021-03-19 17:01:55 -04:00
chris kulla
798d5852e8 Add support for Subsurface Profile shading model in path tracer
The random walk logic now can account for a colored mean free path. A new bsdf was added to account for the dual specular lobes.

Fix some weighting issues in transparency and avoid NaNs when the refraction mode is not based on IOR.

#rb Patrick.Kelly

[CL 15732683 by chris kulla in ue5-main branch]
2021-03-17 20:18:20 -04:00