You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
38 lines
1.3 KiB
Plaintext
38 lines
1.3 KiB
Plaintext
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
/*=============================================================================
|
|
PostProcessLensFlares.usf: PostProcessing Lens Flares.
|
|
=============================================================================*/
|
|
|
|
#include "Common.usf"
|
|
#include "PostProcessCommon.usf"
|
|
|
|
// RGB:color, a:unused
|
|
float4 FlareColor;
|
|
// UV is in 0..1 range but the viewport might not cover the full screen
|
|
float2 TexScale;
|
|
|
|
|
|
// pixel shader, can be optimized by using additive blending
|
|
void CopyPS(float4 InUV : TEXCOORD0, out float4 OutColor : SV_Target0)
|
|
{
|
|
OutColor = Texture2DSample(PostprocessInput0, PostprocessInput0Sampler, InUV.xy);
|
|
}
|
|
|
|
// pixel shader entry point
|
|
void MainPS(in float4 UVAndScreenPos : TEXCOORD0, out float4 OutColor : SV_Target0)
|
|
{
|
|
float2 UV = UVAndScreenPos.xy;
|
|
float2 ScreenPos = UVAndScreenPos.zw;
|
|
|
|
// circular shape to mark the screen border (needed but can be implemented with different math)
|
|
float ScreenborderMask = DiscMask(ScreenPos);
|
|
|
|
// extra circular shape aligned to the screen to mask big lens flares
|
|
ScreenborderMask *= DiscMask(ScreenPos * 0.8f);
|
|
|
|
OutColor.rgb = Texture2DSample(PostprocessInput1, PostprocessInput1Sampler, UV).rgb * FlareColor.rgb * ScreenborderMask;
|
|
OutColor.a = 0;
|
|
}
|
|
|