1.3 KiB
1.3 KiB
PostProcess
ToneMapping
c++部分主要修改了:
- PostProcessing.cpp
- PostProcessTonemap.cpp
- PostProcessTonemap.h
实现向ToneMaper Shader传递 TRDGUniformBufferRef<FSceneTextureUniformParameters>
的功能
之后再PostProcessTonemap.usf中,对CustomStencil进行判断,如果为true,则直接返回之前渲染结果。
#include "DeferredShadingCommon.ush"
// pixel shader entry point
void MainPS(
in noperspective float2 UV : TEXCOORD0,
in noperspective float2 InVignette : TEXCOORD1,
in noperspective float4 GrainUV : TEXCOORD2,
in noperspective float2 ScreenPos : TEXCOORD3,
in noperspective float2 FullViewUV : TEXCOORD4,
float4 SvPosition : SV_POSITION, // after all interpolators
out float4 OutColor : SV_Target0
#if OUTPUT_LUMINANCE
, out float OutLuminance: SV_Target1
#endif
)
{
float Luminance;
FGBufferData SamplerBuffer = GetGBufferData(UV * View.ResolutionFractionAndInv.x, false);
if (SamplerBuffer.CustomStencil > 1.0f && abs(SamplerBuffer.CustomDepth - SamplerBuffer.Depth) < 1)
{
OutColor = SampleSceneColor(UV);
}
else
{
OutColor = TonemapCommonPS(UV, InVignette, GrainUV, ScreenPos, FullViewUV, SvPosition, Luminance);
}
#if OUTPUT_LUMINANCE
OutLuminance = Luminance;
#endif
}