Files
UnrealEngineUWP/Engine/Shaders/Private/PostProcessLocalExposure.usf
tiago costa a074a8e460 Local Exposure using Bilaterial Grid based Contrast Reduction.
- Image exposure is locally adjusted by decomposing luminance of the frame into a base layer and a detail layer.
- Base layer contrast can be reduced while preserving detail.
- Support blending with gaussian blurred luminance as proposed in Advances in Real-Time Rendering in Games 2021.
- Controls in PostProcessVolume.
- r.LocalExposure cvar to control whether local exposure is supported.
- Visualization mode in "Show->Visualize->Local Expsoure". Multiple modes controllable using r.LocalExposure.VisualizeDebugMode.
- Bilateral grid generation not yet optimized. Optimization should include increasing depth of grid to match histogram size so that global histogram can be generated from grid.
- Added option to use mirror address mode in PostProcessWeightedSampleSum, since black border adds noticeable vignetting to the blurred luminance.

#preflight 612f65169db3090001ba3eec
#rb Brian.Karis, Guillaume.Abadie, Krzysztof.Narkowicz


#ROBOMERGE-SOURCE: CL 17385317
#ROBOMERGE-BOT: (v865-17346139)

[CL 17387198 by tiago costa in ue5-main branch]
2021-09-01 11:20:37 -04:00

19 lines
610 B
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
#include "Common.ush"
#include "ScreenPass.ush"
#include "PostProcessHistogramCommon.ush"
SCREEN_PASS_TEXTURE_VIEWPORT(Input)
Texture2D InputTexture;
RWTexture2D<float> Output2DFRW;
[numthreads(THREADGROUP_SIZEX, THREADGROUP_SIZEY, 1)]
void SetupLogLuminanceCS(uint3 DispatchThreadId : SV_DispatchThreadID)
{
float3 SceneColor = InputTexture.Load(uint3(Input_ViewportMin + DispatchThreadId.xy, 0)).rgb * View.OneOverPreExposure;
float LuminanceVal = CalculateEyeAdaptationLuminance(SceneColor);
Output2DFRW[DispatchThreadId.xy] = log2(LuminanceVal);
}