Commit Graph

343 Commits

Author SHA1 Message Date
chris kulla
cacbf35802 Path Tracer: Implement support for virtual texture feedback
This allows skipping the basepass when the path tracer is active, reducing overhead.

VT feedback logic is identical to the rasterizer for now, and will not restart the path tracer accumulation. This is not noticeable in the editor as the right VT pages are loaded fairly quickly. In the offline case, this could potentially lead to some textures being blurrier for some samples, but with proper warmup this should not be noticeable either.

Note that the VT feedback logic is only executed for camera rays for now.

#rb Jeremy.Moore

[CL 27872518 by chris kulla in ue5-main branch]
2023-09-14 05:19:55 -04:00
chris kulla
b247e3f050 Path Tracer: Modify Depth output to take min over entire filter footprint
The current logic was limiting the depth write to only happen for rays passing through the pixel square, but in practice it is more desireable for compositing to have the depth output in sync with the alpha channel. Keep the old logic around temporarily until the new behavior has been confirmed to produce the desired results.

#rb trivial

[CL 27768573 by chris kulla in ue5-main branch]
2023-09-11 16:10:15 -04:00
chris kulla
21b82bfd40 Path Tracer: Alpha channel should not be affected by exposure
#rb trivial

[CL 27737352 by chris kulla in ue5-main branch]
2023-09-09 02:14:56 -04:00
chris kulla
ef412c9670 Path Tracing: Implement Adaptive sampling
Implement a basic adaptive sampling strategy. This is not yet exposed in the UI, it must be enabled by the cvar: "r.PathTracing.AdaptiveSampling".

When enabled, the path tracer keeps track of a variance buffer. This variance buffer can then be used to predict the number of samples requires to reach a prescribed error threshold. This is used to de-active pixels that are deemed to be converged already, speeding up rendering of mostly converged areas.

The error estimate operates on multiple scales (mip maps) so that we have a more robust estimate of the variance even with very low sample counts. Currently the error estimate runs after each pass, and is used by the next sample to decide which pixels are still active.

A proper integration with MRQ (in particular the reference motion blur mode) is not yet done, as this will require a different way of stepping through temporal samples.This will be investigated as part of the MRQ 2.0 interface.

This feature (along with a few other path tracer permutations) is now gated behind r.PathTracing.Experimental (off by default) to avoid bloating startup times.

The adaptive metric is relative to the current exposure level. This means that the combination of adaptive sampling and auto-exposure has a feedback loop which could lead to unpredictable results. Therefore manual exposure is recommended when using adaptive sampling. In particular, when using the adaptive sampling visualization modes with auto-exposure, a feedback effect can be observed as the visualization influences the exposure level. A proper fix for this would be to move the visualization of adaptive sampling after tonemapping. This is left as future work for now to minimize the "spread" of this feature for now.

#rb Patrick.Kelly

[CL 27697971 by chris kulla in ue5-main branch]
2023-09-07 20:33:35 -04:00
marc audy
65de35fdfb Lof elements that were not renamed yet.
- MSM_Substrate
- MCT_Substrate
- FStrataMaterialInput

#rb charles.derousiers

[CL 27563163 by marc audy in ue5-main branch]
2023-09-01 15:06:19 -04:00
dan elksnitis
6cc4950575 [shaders]
- modify versioning mechanisms to use UEMETADATA pragmas
- update commands which generate version.ush files to generate such pragmas instead of comments
- include the above pragma-driven version(s) in the input hash when preprocessed job cache is enabled (not needed for the disabled case since as before the entire contents of the version files are hashed)
- fix bug in stb_preprocessor that was causing it to stop expanding macros if any diagnostic was encountered (and rename the array field storing diagnostic messages to diagnostics, since it contains more than just errors)

#rb Yuriy.ODonnell

[CL 27515060 by dan elksnitis in ue5-main branch]
2023-08-31 04:49:18 -04:00
tiantian xie
8d460906fd Fix multi-channel variance output error for path tracing when r.PathTracing.Denoiser.Prepass.VarianceType is set to 0.
#rb trivial

#ushell-cherrypick of 27454998 by Tiantian.Xie

[CL 27514932 by tiantian xie in ue5-main branch]
2023-08-31 04:46:51 -04:00
sebastien hillaire
09ef6f1c14 Substrate - Rename/move file(s) for shader folder only.
#rb none
[FYI] charles.derousiers

[CL 27514918 by sebastien hillaire in ue5-main branch]
2023-08-31 04:46:35 -04:00
patrick kelly
14c30983cb Dead code removal
#rb none
[FYI] chris.kulla

[CL 27464925 by patrick kelly in ue5-main branch]
2023-08-29 16:45:42 -04:00
patrick kelly
4001fa041d PathTracing: Correctly support mixing of HeterogeneousVolumes with SkyAtmosphere and HeightFog.
#rb chris.kulla
#jira UE-193867

[CL 27457573 by patrick kelly in ue5-main branch]
2023-08-29 14:26:30 -04:00
chris kulla
e29f35a219 Path Tracer: Fix distant lights not obeying cast volume shadows
Cleanup various small issues with heterogenous volumes and remove unused arguments (PathRoughness and Bounce were passed around inconsistently but not used in the end)

#rb Patrick.Kelly
#jira UE-192885

[CL 27080180 by chris kulla in ue5-main branch]
2023-08-14 14:54:17 -04:00
chris kulla
7c425a21ea Path Tracer: Implement Rank-1 Lattice Random Sequence in the RandomSequence interface
This is much faster than Sobol and appears to have similar quality. The default is still Sobol for now until we can accurately quantify the convergence differences.

#rb none

[CL 26837412 by chris kulla in ue5-main branch]
2023-08-03 22:30:27 -04:00
chris kulla
e1775eb82d Path Tracing: Fix anisotropy encoding in Substrate payloads
The payload encoding for anisotropy did not allow representing 0.0 anisotropy exactly. This in turn could lead to NaNs when the world tangent aligned with the shading normal.

#rb trivial

[CL 26302420 by chris kulla in ue5-main branch]
2023-06-28 19:18:32 -04:00
sebastien hillaire
f005dc19b5 Substrate - clean up some old not unused nulladdressing code.
#rb none
[FYI] charles.derousiers

[CL 26207330 by sebastien hillaire in ue5-main branch]
2023-06-23 05:57:21 -04:00
sebastien hillaire
1a7b0e0f71 Substrate - Unlit BSDF support weigth operator and goes though the Strata tree.
#rb none
[FYI] charles.derousiers

[CL 26207324 by sebastien hillaire in ue5-main branch]
2023-06-23 05:57:15 -04:00
chris kulla
eda5f6b85c Path Tracer: Fix dark refraction with SingleLayerWater materials
This was actually caused by the Tangent Space Normal setting not being respected properly.

Also cleanup unused code for SLW for the substrate case.

#rb Aleksander.Netzel

[CL 26190217 by chris kulla in ue5-main branch]
2023-06-22 15:06:34 -04:00
chris kulla
57e91c3478 Simplify the logic for GGX Visible normal sampling
Note that the new code accepts a pair of random numbers in the unit square instead of on the unit disk. This required updating all callers (which all passed in the result of UniformSampleDisk anyway).

Also, call the aniso variant which saves a useless square followed by sqrt. The old non-aniso method is removed as there is no real savings to be had from the non-anisotropic case anymore.

#rb Sebastien.Hillaire

[CL 26031587 by chris kulla in ue5-main branch]
2023-06-15 20:36:40 -04:00
eric renaudhoude
402fcbe18d ColorManagement: Enhancing ColorSpace.ush for variable working color spaces.
#jira UE-159144
#rb sebastien.hillaire, rod.bogart
#rnx

[CL 26007367 by eric renaudhoude in ue5-main branch]
2023-06-15 05:41:58 -04:00
charles derousiers
34c6c73c28 Add Disney LTC cloth model to the pather tracer.
#rb chris.kulla
[FYI] sebastien.hillaire

[CL 25910635 by charles derousiers in ue5-main branch]
2023-06-10 08:58:57 -04:00
charles derousiers
c8e424126e Change SpecularProfile evalution to be shared.
#rb none
[FYI] sebastien.hillaire

[CL 25910335 by charles derousiers in ue5-main branch]
2023-06-10 02:09:01 -04:00
patrick kelly
4f4982b7a9 Heterogeneous Volumes: Modifying frustum grid to respect custom field-of-view
#rb stu.mckenna

[CL 25910327 by patrick kelly in ue5-main branch]
2023-06-10 02:08:50 -04:00
chris kulla
9d83f29621 Path Tracer: Change refraction rays to behave more like camera rays with respect to affect indirect
This makes refraction and transparency behave more consistently with one another.

#rb none

[CL 25910323 by chris kulla in ue5-main branch]
2023-06-10 02:08:45 -04:00
chris kulla
a026d90edb Path Tracer: Fix compilation error when substrate is enabled
#rb trivial

[CL 25886994 by chris kulla in ue5-main branch]
2023-06-08 21:31:09 -04:00
chris kulla
7592dad893 Path Tracing: Fix darkening in SSS
When the subsurface scattering radius become small, a fair amount of energy is lost which darkens the result in an un-desireable way. To avoid this, clamp the radius to a safe value and blend the subsurface albedo back towards diffuse instead. This keeps the overall energy contribution while avoiding small radii. It also improves the transition between radius 0 and radius slightly above 0.

#rb none

[CL 25870598 by chris kulla in ue5-main branch]
2023-06-08 10:13:25 -04:00
charles derousiers
3448f6a9c8 Add initial glint support for PT.
Current limitations:
* The GlintUV derivatives are incorrect/hardcoded for now.
* Sampling is done as a single lobe, without knowledge of the glints.

#rb chris.kulla
[FYI] sebastien.hillaire

[CL 25837504 by charles derousiers in ue5-main branch]
2023-06-07 02:55:42 -04:00