You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
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]
42 lines
986 B
Plaintext
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;
|
|
}
|