Files
UnrealEngineUWP/Engine/Shaders/Private/Tools/DebugAlphaChannel.usf
guillaume abadie 56e0701f51 Fixes a source of ghosting in TSR's alpha channel
This notably implements new r.Test.Alpha.* cvars to more easily generate and debug an alpha channel in any project

#jira UE-179496
[FYI] eric.renaudhoude

[CL 28613389 by guillaume abadie in ue5-main branch]
2023-10-10 05:32:12 -04:00

42 lines
986 B
Plaintext

// Copyright Epic Games, Inc. All Rights Reserved.
#include "../Common.ush"
//------------------------------------------------------- PARAMETERS
uint DebugModeId;
float OpaqueWorldDistance;
float OpaqueLerpWorldRange;
Texture2D<float4> SceneColorTexture;
Texture2D<float> SceneDepthTexture;
RWTexture2D<float4> SceneColorOutput;
//------------------------------------------------------- ENTRY POINT
[numthreads(8, 8, 1)]
void MainCS(uint2 DispatchThreadId : SV_DispatchThreadID)
{
int2 PixelPos = View.ViewRectMinAndSize.xy + DispatchThreadId;
float DeviceZ = SceneDepthTexture[PixelPos];
float4 SceneColor = SceneColorTexture[PixelPos];
float WorldDepth = ConvertFromDeviceZ(DeviceZ);
float4 Output = SceneColor;
BRANCH
if (DebugModeId == 0)
{
float IsTranslucent = saturate((WorldDepth - OpaqueWorldDistance) * rcp(OpaqueLerpWorldRange));
SceneColor.rgb *= 1.0 - IsTranslucent;
SceneColor.a = IsTranslucent;
}
SceneColorOutput[PixelPos] = SceneColor;
}