Files
UnrealEngineUWP/Engine/Shaders/PostProcessMaterialShaders.usf
Martin Mittring e75acb9b8a Merging from Orion
CL 2699552
  added SvPositionToTranslatedWorld for better quality and performance, some refactoring

[CL 2699586 by Martin Mittring in Main branch]
2015-09-21 15:59:33 -04:00

44 lines
1.2 KiB
Plaintext

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
PostProcessMaterialShaders.usf: Shaders for rendering post process materials
=============================================================================*/
#include "Common.usf"
#include "Material.usf"
void MainVS(
in float4 InPosition : ATTRIBUTE0,
out float4 OutPosition : SV_POSITION
)
{
DrawRectangle(InPosition, OutPosition);
}
void MainPS(
in float4 SvPosition : SV_Position, // after all interpolators
out float4 OutColor : SV_Target0
)
{
FMaterialPixelParameters Parameters = MakeInitializedMaterialPixelParameters();
// can be optimized
float2 ScreenUV = SvPositionToBufferUV(SvPosition);
#if NUM_MATERIAL_TEXCOORDS
for(int CoordinateIndex = 0;CoordinateIndex < NUM_MATERIAL_TEXCOORDS;CoordinateIndex++)
{
Parameters.TexCoords[CoordinateIndex] = ScreenUV;
}
#endif
Parameters.VertexColor = 1;
SvPosition.z = LookupDeviceZ(ScreenUV);
// fill out other related material parameters
CalcMaterialParameters(Parameters, SvPosition, true);
// Grab emissive colour as output
OutColor = float4(GetMaterialEmissive(Parameters), 1);
}