1
我是很新的HLSL请多多包涵......XNA HLSL纹理掩蔽效应不使用阿尔法掩码
这是有效果的文件:
sampler s0;
texture tex;
sampler tex_sampler = sampler_state{Texture = tex;};
float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
float4 color = tex2D(s0, coords);
float4 tex_color = tex2D(tex_sampler, coords);
if (tex_color.a)
{
// SOMETHING GOES RIGHT HERE BUT I DON'T KNOW WHAT
return color;
}
return tex_color;
}
technique Technique1
{
pass Pass1
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
的“TEX”场是面具。 “tex_sampler”是面具的取样器。
结果包含带有1或0 alpha的像素,但是mask实际上是模糊的并且包含不同的alpha值。我应该添加或更改哪些内容才能使其符合我的要求?否则这个工作完全顺利。