UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PathTracingSpatialTemporalDenoising.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
3
#pragma once
4
5
#include "
PathTracingDenoiser.h
"
6
#include "
RHIDefinitions.h
"
7
8
#if RHI_RAYTRACING
9
10
#include "
RenderGraphFwd.h
"
11
#include "
ScreenPass.h
"
12
13
class
FRDGBuilder
;
14
class
FScene
;
15
class
FViewInfo
;
16
class
FRDGTexture
;
17
18
struct
FPathTracingSpatialTemporalDenoisingContext
19
{
20
FRDGTexture
*
RadianceTexture
=
nullptr
;
21
FRDGTexture
*
AlbedoTexture
=
nullptr
;
22
FRDGTexture
* NormalTexture =
nullptr
;
23
FRDGTexture
* DepthTexture =
nullptr
;
24
FRDGBuffer
*
VarianceBuffer
=
nullptr
;
25
26
FRDGTexture
*
LastDenoisedRadianceTexture
=
nullptr
;
27
FRDGTexture
*
LastRadianceTexture
=
nullptr
;
28
FRDGTexture
*
LastAlbedoTexture
=
nullptr
;
29
FRDGTexture
*
LastNormalTexture
=
nullptr
;
30
FRDGTexture
*
LastDepthTexture
=
nullptr
;
31
FRDGBuffer
*
LastVarianceBuffer
=
nullptr
;
32
33
// Custom path tracing spacial temporal denoiser result, used by plugins
34
TRefCountPtr<UE::Renderer::Private::IPathTracingSpatialTemporalDenoiser::IHistory>
SpatialTemporalDenoiserHistory
;
35
36
int
FrameIndex;
37
38
static
constexpr
uint32
kNumberOfPixelShifts
= 25;
39
static
constexpr
uint32
kNumberOfShiftsPerTexture
= 4;
40
static
constexpr
uint32
kNumberOfPasses
= 1;
41
static
constexpr
uint32
kNumberOfTexturesPerPass
=
42
(
kNumberOfPixelShifts
+ (
kNumberOfShiftsPerTexture
*
kNumberOfPasses
) - 1)
43
/ (
kNumberOfShiftsPerTexture
*
kNumberOfPasses
);
44
45
// Debug information
46
FRDGTexture
*
MotionVector
=
nullptr
;
47
FRDGTexture
*
WarpedSource
=
nullptr
;
48
49
// Utility texture
50
FRDGTexture
*
VarianceTexture
=
nullptr
;
51
};
52
53
54
int
GetPathTracingDenoiserMode
(
const
FViewInfo
& View);
55
bool
IsPathTracingDenoiserEnabled
(
const
FViewInfo
& View);
56
bool
ShouldEnablePathTracingDenoiserRealtimeDebug
();
57
ETextureCreateFlags
GetExtraTextureCreateFlagsForDenoiser
();
58
59
// Calculate the variance per-pixel.
60
void
PathTracingSpatialTemporalDenoisingPrePass
(
61
FRDGBuilder
& GraphBuilder,
62
const
FViewInfo
& View,
63
int
IterationNumber
,
64
int
MaxSPP
,
65
FPathTracingSpatialTemporalDenoisingContext
&
SpatialTemporalDenoisingContext
66
);
67
68
void
PathTracingSpatialTemporalDenoising
(
FRDGBuilder
& GraphBuilder,
69
const
FViewInfo
& View,
70
int
DenoiserMode
,
71
FRDGTexture
*&
SpatialTemporalDenoisedTexture
,
72
FPathTracingSpatialTemporalDenoisingContext
&
SpatialTemporalDenoisingContext
);
73
74
struct
FVisualizePathTracingDenoisingInputs
75
{
76
// [Optional] Render to the specified output. If invalid, a new texture is created and returned.
77
FScreenPassRenderTarget
OverrideOutput;
78
FRDGTextureRef
SceneColor
;
79
FRDGTextureRef
DenoisedTexture
;
80
FScreenPassTextureViewport
Viewport;
81
82
FPathTracingSpatialTemporalDenoisingContext
DenoisingContext
;
83
84
TRDGUniformBufferRef<FSceneTextureUniformParameters>
SceneTexturesUniformBuffer;
85
};
86
87
FScreenPassTexture
AddVisualizePathTracingDenoisingPass
(
FRDGBuilder
& GraphBuilder,
const
FViewInfo
& View,
const
FVisualizePathTracingDenoisingInputs
& Inputs);
88
89
#endif
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
PathTracingDenoiser.h
RHIDefinitions.h
ETextureCreateFlags
ETextureCreateFlags
Definition
RHIDefinitions.h:1091
RenderGraphFwd.h
ELumenScreenTracingSource::SceneColor
@ SceneColor
ScreenPass.h
uint32
uint32_t uint32
Definition
binka_ue_file_header.h:6
FRDGBuffer
Definition
RenderGraphResources.h:1321
FRDGBuilder
Definition
RenderGraphBuilder.h:49
FRDGTexture
Definition
RenderGraphResources.h:571
FScene
Definition
ScenePrivate.h:2875
FScreenPassTextureViewport
Definition
ScreenPass.h:136
FViewInfo
Definition
SceneRendering.h:1132
TRDGUniformBuffer
Definition
RenderGraphResources.h:251
TRefCountPtr
Definition
RefCounting.h:454
FScreenPassRenderTarget
Definition
ScreenPass.h:83
FScreenPassTexture
Definition
ScreenPass.h:41
Engine
Source
Runtime
Renderer
Private
PathTracingSpatialTemporalDenoising.h
Generated by
1.9.8