2014-12-07 19:09:38 -05:00
|
|
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
2014-03-14 14:13:41 -04:00
|
|
|
|
|
|
|
|
/*=============================================================================
|
|
|
|
|
SimpleElementNormalMapPixelShader.hlsl: Pixel shader for previewing normal
|
|
|
|
|
map textures rendered as simple elements.
|
|
|
|
|
=============================================================================*/
|
|
|
|
|
|
|
|
|
|
#include "Common.usf"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Texture2D NormalMapTexture;
|
|
|
|
|
SamplerState NormalMapTextureSampler;
|
|
|
|
|
|
|
|
|
|
void Main(
|
|
|
|
|
in float2 TextureCoordinate : TEXCOORD0,
|
|
|
|
|
out float4 OutColor : SV_Target0
|
|
|
|
|
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM4
|
|
|
|
|
,out float4 OutWorldNormal : SV_Target1
|
|
|
|
|
,out float4 OutSpecularColorAndPower : SV_Target2
|
|
|
|
|
#endif
|
|
|
|
|
)
|
|
|
|
|
{
|
|
|
|
|
const float4 NormalSample = Texture2DSample(NormalMapTexture, NormalMapTextureSampler, TextureCoordinate);
|
|
|
|
|
const float4 Normal = UnpackNormalMap(NormalSample);
|
|
|
|
|
const float4 RescaledNormal = float4(Normal.xyz * 0.5 + 0.5, 1);
|
|
|
|
|
OutColor = RETURN_COLOR(RescaledNormal);
|
|
|
|
|
|
|
|
|
|
#if FEATURE_LEVEL >= FEATURE_LEVEL_SM4
|
|
|
|
|
// Set the G buffer bits that indicate that deferred lighting and image reflections are not enabled
|
|
|
|
|
OutWorldNormal = 0;
|
|
|
|
|
OutSpecularColorAndPower = 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|