You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
37 lines
1.4 KiB
Plaintext
37 lines
1.4 KiB
Plaintext
|
|
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
||
|
|
|
||
|
|
/*=============================================================================
|
||
|
|
PostProcessVisualizeGBuffer.usf: PostProcessing shader to visualize the GBuffer
|
||
|
|
=============================================================================*/
|
||
|
|
|
||
|
|
#include "Common.usf"
|
||
|
|
#include "PostProcessCommon.usf"
|
||
|
|
#include "DeferredShadingCommon.usf"
|
||
|
|
#include "PostProcessHistogramCommon.usf"
|
||
|
|
|
||
|
|
/** Main pixel shader function */
|
||
|
|
void MainPS(float4 UVAndScreenPos : TEXCOORD0, out float4 OutColor : SV_Target0)
|
||
|
|
{
|
||
|
|
float Alpha = 1;
|
||
|
|
|
||
|
|
#if DRAWING_TILE
|
||
|
|
int2 PixelPos = (int2)(UVAndScreenPos.zw * ScreenPosToPixel.xy + ScreenPosToPixel.zw + 0.5f);
|
||
|
|
|
||
|
|
// half viewport size
|
||
|
|
int2 HalfInsetSize = (int2)(ViewportSize.xy / 2);
|
||
|
|
// quarter viewport size
|
||
|
|
int2 QuarterInsetSize = (int2)(ViewportSize.xy / 4);
|
||
|
|
|
||
|
|
// 16 tiles over the full viewport
|
||
|
|
int2 QuarterTileXY = (int2)((uint2)PixelPos / QuarterInsetSize);
|
||
|
|
// pixel position within a quartertile
|
||
|
|
int2 QuarterTileLocalPos = PixelPos - QuarterTileXY * QuarterInsetSize;
|
||
|
|
|
||
|
|
const int Border1 = 10;
|
||
|
|
const int Border2 = 8;
|
||
|
|
float BorderDistance = ComputeDistanceToRect(QuarterTileLocalPos, int2(0, 0) + Border1.xx, QuarterInsetSize - 2 * Border1.xx);
|
||
|
|
Alpha = 1 - saturate((BorderDistance - Border2.x) * 0.5f);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
OutColor = float4(Texture2DSample(PostprocessInput0, PostprocessInput0Sampler, UVAndScreenPos.xy).rgb, Alpha);
|
||
|
|
}
|