utkuatlastuzcu/tst / Engine /Shaders /DistortApplyScreenPixelShader.usf
utkuatlastuzcu's picture
download
raw
1.41 kB
/*=============================================================================
DistortApplyScreenPixelShader.usf: Pixel shader for rendering screen distortion pass
Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
=============================================================================*/
#include "Common.usf"
static const half InvDistortionScaleBias = 1 / 4.0f;
/**
* contains accumulated distortion values as
* R=positive horizontal offset
* G=positive vertical offset
* B=negative horizontal offset
* A=negative vertical offset
*/
sampler2D AccumulatedDistortionTexture;
/** distorts screen texture using accumulated distortion offsets */
void Main(
in float2 TexCoord: TEXCOORD0,
out float4 OutColor : COLOR0
)
{
// sample accumulated distortion and apply inverse scale
half4 AccumDist = tex2D(AccumulatedDistortionTexture,TexCoord);
// offset = [R-B,G-A] and flip Y
half2 DistOffset = (AccumDist.rg - AccumDist.ba) * half2(InvDistortionScaleBias,-InvDistortionScaleBias);
#if SUPPORTS_DEPTH_TEXTURES
// sample screen using offset coords
half3 DistColor = tex2D(SceneColorTexture, TexCoord + DistOffset).xyz;
OutColor = half4(DistColor,0);
#else
// sample screen using offset coords, distorting both scene color and depth
half4 DistColor = CalcFullSceneColor(TexCoord + DistOffset);
OutColor = RETURN_COLOR( DistColor );
#endif
}

Xet Storage Details

Size:
1.41 kB
·
Xet hash:
e68a413730c9158bfa5c6c8439ed48064d39af5b8ad4dd0b19f01bfd9a0bfec0

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.