Files
UnrealEngineUWP/Engine/Shaders/SimpleElementColorChannelMaskPixelShader.usf
Ben Marsh 149375b14b Update copyright notices to 2015.
[CL 2379638 by Ben Marsh in Main branch]
2014-12-07 19:09:38 -05:00

53 lines
1.6 KiB
Plaintext

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
SimpleElementColorChannelMaskPixelShader.hlsl: Pixel shader for manipulating weights of color channels
=============================================================================*/
#include "Common.usf"
Texture2D InTexture;
SamplerState InTextureSampler;
float4x4 ColorWeights;
float Gamma;
bool bAlphaOnly;
void Main(
in float2 TextureCoordinate : TEXCOORD0,
in float4 Color : TEXCOORD1,
out float4 OutColor : SV_Target0
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM4
,out float4 OutWorldNormal : SV_Target1
,out float4 OutReflectionWorldNormal : SV_Target2
,out float4 OutSpecularColorAndPower : SV_Target3
#endif
)
{
float4 BaseColor = Texture2DSample(InTexture, InTextureSampler,TextureCoordinate);
float4 FinalColor;
// Seperate the Color weights and use against the Base colour to detrmine the actual colour from our filter
FinalColor.r = dot(BaseColor, ColorWeights[0]);
FinalColor.g = dot(BaseColor, ColorWeights[1]);
FinalColor.b = dot(BaseColor, ColorWeights[2]);
FinalColor.a = dot(BaseColor, ColorWeights[3]);
if( Gamma != 1.0 )
{
// Gamma correct the output color.
FinalColor.rgb = pow(saturate(FinalColor.rgb),Gamma);
}
FinalColor*=Color;
OutColor = RETURN_COLOR(FinalColor);
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM4
// Set the G buffer bits that indicate that deferred lighting and image reflections are not enabled
OutWorldNormal = 0;
OutReflectionWorldNormal = 0;
OutSpecularColorAndPower = 0;
#endif
}