首先更改UI的shader。
结构体:
Engine_Updating\Engine\Shaders\SlateShaderCommon.usf
struct VertexToPixelInterpolants
{
float4 Position : SV_POSITION;
float4 Color : COLOR0;
float4 ClipOriginAndPos : TEXCOORD0;
float4 ClipExtents : TEXCOORD1;
float2 MaterialTexCoords : TEXCOORD2;
float4 TextureCoordinates[NUM_SLATE_TEXCOORDS] : TEXCOORD3;
<span style="background-color: rgb(255, 102, 102);">float DisableValue:TEXCOORD4;</span>
};
VertexShader:
Engine_Updating\Engine\Shaders\SlateVertexShader.usf
VertexToPixelInterpolants Main(
in float4 InTextureCoordinates : ATTRIBUTE0,
in float2 InMaterialTextureCoordinates : ATTRIBUTE1,
in float2 InPosition : ATTRIBUTE2,
in float2 InClipOrigin : ATTRIBUTE3,
in float4 InClipExtents : ATTRIBUTE4,
in float4 InColor : ATTRIBUTE5,
<span style="color:#ff6666;">in float InDisableValue : ATTRIBUTE6</span>
#if USE_SLATE_INSTANCING
, in float4 InstanceParam : ATTRIBUTE7
#endif
)
{
VertexToPixelInterpolants VOut = (VertexToPixelInterpolants)0;
float4 WorldPosition = float4(InPosition.xy,0,1);
#if (!(ES2_PROFILE || ES3_1_PROFILE)) || USE_MATERIALS
InColor.rgb = sRGBToLinear(InColor.rgb);
#endif
float4 FinalVertexColor = InColor FCOLOR_COMPONENT_SWIZZLE;
VOut.MaterialTexCoords = InMaterialTextureCoordinates;
VOut.ClipOriginAndPos = float4(InClipOrigin, InPosition.xy);
VOut.ClipExtents = InClipExtents;
VOut.Color = FinalVertexColor;
VOut.TextureCoordinates[0] = InTextureCoordinates;
<span style="color:#ff6666;">VOut.DisableValue = InDisableValue;</span>
PixelShader:
Engine_Updating\Engine\Shaders\SlateElementPixelShader.usf
#if DRAW_DISABLED_EFFECT
//desaturate
float3 LumCoeffs = float3( 0.3, 0.59, .11 );
float Lum = dot( LumCoeffs, OutColor.rgb );
<span style="color:#ff0000;