UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PostProcessTonemap.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
7#include "ScreenPass.h"
9#include "Math/Halton.h"
10
12
14
17 SHADER_PARAMETER(uint32, OutputDevice)
21
23
24static void GrainRandomFromFrame(FVector3f* RESTRICT const Constant, uint32 FrameNumber)
25{
26 Constant->X = Halton(FrameNumber & 1023, 2);
27 Constant->Y = Halton(FrameNumber & 1023, 3);
28}
29
31{
32 // [Optional] Render to the specified output. If invalid, a new texture is created and returned.
34
35 // [Required] HDR scene color to tonemap.
37
38 // [Required] Filtered bloom texture to composite with tonemapped scene color. This should be transparent black for no bloom.
40
41 // [Optional] structured buffer of multiply parameters to apply to the scene color.
43
44 // [Optional] Luminance bilateral grid. If this is null, local exposure is disabled.
46
47 // [Optional] Blurred luminance texture used to calculate local exposure.
49
50 // [Optional] Exposure Fusion. If this is null, local exposure is disabled.
52
53 // [Optional] Local exposure parameters.
55
56 // [Required] Eye adaptation parameters.
58
59 // [Required] Color grading texture used to remap colors.
61
62 // Eye adaptation buffer used to compute exposure.
64
65 // [Raster Only] Controls whether the alpha channel of the scene texture should be written to the output texture.
66 bool bWriteAlphaChannel = false;
67
68 // Configures the tonemapper to only perform gamma correction.
69 bool bGammaOnly = false;
70
71 // Whether to leave the final output in HDR.
72 bool bOutputInHDR = false;
73
74 bool bMetalMSAAHDRDecode = false;
75
76 // Returns whether ApplyParameters is supported by the tonemapper.
78};
79
80FScreenPassTexture AddTonemapPass(FRDGBuilder& GraphBuilder, const FViewInfo& View, const FTonemapInputs& Inputs);
81void RenderMobileCustomResolve(FRHICommandList& RHICmdList, const FViewInfo& View, const int32 SubpassMSAASamples, FSceneTextures& SceneTextures);
82void AddMobileCustomResolvePass(FRDGBuilder& GraphBuilder, const FViewInfo& View, FSceneTextures& SceneTextures, FRDGTextureRef ViewFamilyTexture);
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define RESTRICT
Definition Platform.h:706
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr float Halton(int32 Index, int32 Base)
Definition Halton.h:9
void AddMobileCustomResolvePass(FRDGBuilder &GraphBuilder, const FViewInfo &View, FSceneTextures &SceneTextures, FRDGTextureRef ViewFamilyTexture)
Definition PostProcessTonemap.cpp:1168
RENDERER_API FTonemapperOutputDeviceParameters GetTonemapperOutputDeviceParameters(const FSceneViewFamily &Family)
Definition PostProcessTonemap.cpp:227
FScreenPassTexture AddTonemapPass(FRDGBuilder &GraphBuilder, const FViewInfo &View, const FTonemapInputs &Inputs)
Definition PostProcessTonemap.cpp:569
bool SupportsFilmGrain(EShaderPlatform Platform)
Definition PostProcessTonemap.cpp:29
void RenderMobileCustomResolve(FRHICommandList &RHICmdList, const FViewInfo &View, const int32 SubpassMSAASamples, FSceneTextures &SceneTextures)
Definition PostProcessTonemap.cpp:1100
EShaderPlatform
Definition RHIShaderPlatform.h:11
#define BEGIN_SHADER_PARAMETER_STRUCT(StructTypeName, DllStorage)
Definition ShaderParameterMacros.h:1482
#define END_SHADER_PARAMETER_STRUCT()
Definition ShaderParameterMacros.h:1485
#define SHADER_PARAMETER(MemberType, MemberName)
Definition ShaderParameterMacros.h:1684
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition RenderGraphResources.h:1321
Definition RenderGraphBuilder.h:49
Definition RenderGraphResources.h:571
Definition RHICommandList.h:3819
Definition SceneView.h:2212
Definition SceneRendering.h:1132
Definition SceneTextures.h:110
Definition ScreenPass.h:83
Definition ScreenPass.h:65
Definition ScreenPass.h:41
Definition PostProcessTonemap.h:31
FScreenPassTextureSlice ExposureFusion
Definition PostProcessTonemap.h:51
bool bWriteAlphaChannel
Definition PostProcessTonemap.h:66
bool bMetalMSAAHDRDecode
Definition PostProcessTonemap.h:74
FRDGTextureRef BlurredLogLuminanceTexture
Definition PostProcessTonemap.h:48
FScreenPassTexture Bloom
Definition PostProcessTonemap.h:39
FRDGBufferRef EyeAdaptationBuffer
Definition PostProcessTonemap.h:63
static bool SupportsSceneColorApplyParametersBuffer(EShaderPlatform Platform)
Definition PostProcessTonemap.cpp:472
bool bOutputInHDR
Definition PostProcessTonemap.h:72
FScreenPassTextureSlice SceneColor
Definition PostProcessTonemap.h:36
bool bGammaOnly
Definition PostProcessTonemap.h:69
FRDGBufferRef SceneColorApplyParamaters
Definition PostProcessTonemap.h:42
const FLocalExposureParameters * LocalExposureParameters
Definition PostProcessTonemap.h:54
FRDGTextureRef ColorGradingTexture
Definition PostProcessTonemap.h:60
const FEyeAdaptationParameters * EyeAdaptationParameters
Definition PostProcessTonemap.h:57
FRDGTextureRef LocalExposureBilateralGridTexture
Definition PostProcessTonemap.h:45
FScreenPassRenderTarget OverrideOutput
Definition PostProcessTonemap.h:33