-
Notifications
You must be signed in to change notification settings - Fork 0
/
50masktexture.fx
40 lines (33 loc) · 932 Bytes
/
50masktexture.fx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
Author: 50p
Version: v1.0
Description:
This shader allows you to mask a texture with a mask texture (black and white).
*/
texture ScreenTexture;
sampler implicitInputTexture = sampler_state
{
Texture = <ScreenTexture>;
};
texture MaskTexture;
sampler implicitMaskTexture = sampler_state
{
Texture = <MaskTexture>;
};
float4 MaskTextureMain( float2 uv : TEXCOORD0 ) : COLOR0
{
float4 sampledTexture = tex2D( implicitInputTexture, uv );
float4 maskSampled = tex2D( implicitMaskTexture, uv );
sampledTexture.a = (maskSampled.r + maskSampled.g + maskSampled.b) / 3.0f;
return sampledTexture;
}
technique Technique1
{
pass Pass1
{
AlphaBlendEnable = true;
SrcBlend = SrcAlpha;
DestBlend = InvSrcAlpha;
PixelShader = compile ps_2_0 MaskTextureMain();
}
}