maybe you should write your own small Shader because of controlling.
Example: Set alpha to View-Bitmap (clear the bitmap)
Texture TargetMap;
sampler2D SrcColor = sampler_state
{
texture = <TargetMap>;
MinFilter = linear;
MagFilter = linear;
MipFilter = linear;
AddressU = Clamp;
AddressV = Clamp;
};
float4 FillAlpha( float2 texCoord : TEXCOORD0 ) : COLOR0
{
float4 color;
color = tex2D(SrcColor, texCoord);
color.a = 0;
color.rgb = 1;
return color;
}
technique PostProcess
{
pass p1
{
AlphaBlendEnable = false;
VertexShader = null;
PixelShader = compile ps_1_0 FillAlpha();
}
}
MATERIAL* MatObjFillAlpha =
{
effect ="FillAlpha.fx";
}
View.bmap = bmap_for_entity(my, 1);
bmap_process (View.bmap, NULL, MatObjFillAlpha);
And your bmap_process is wrong, set NULL to Source.
If you want to set Alpha Channel to Emboss, set AlphablendEnable to true and set Color.a
Texture TargetMap;
sampler2D g_samSrcColor = sampler_state { texture = <TargetMap>; MipFilter = Linear; };
float4 vecViewPort;
float4 postprocessing_emboss( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 Color = float4(0.5,0.5,0.5,1.0);
Color -= tex2D( g_samSrcColor, Tex.xy-vecViewPort.zw)*2.0f;
Color += tex2D( g_samSrcColor, Tex.xy+vecViewPort.zw)*2.0f;
Color.rgb = (Color.r+Color.g+Color.b)/3.0f;
Color.a = 0.2;
return Color;
}
technique PostProcess
{
pass p1
{
AlphaBlendEnable = true;
VertexShader = null;
PixelShader = compile ps_2_0 postprocessing_emboss();
}
}