Heyo,
I got a little problem. I am writing shaders for Image Factory and one of them is a "color-to-alpha" shader [like the option in Gimp], but I cannot get the alpha transparency working.
float4 vecSkill1;
texture TargetMap;
sampler smpSource = sampler_state { texture = <TargetMap>; };
float4 ColorToAlpha_PS( float2 Tex : TEXCOORD0 ) : COLOR0
{
float4 AlphaColor;
float4 Color;
AlphaColor = tex2D( smpSource, Tex.xy);
AlphaColor.r -= vecSkill1.x;
AlphaColor.g -= vecSkill1.y;
AlphaColor.b -= vecSkill1.z;
AlphaColor.a = abs(AlphaColor.r)+abs(AlphaColor.g)+abs(AlphaColor.b);
AlphaColor.a /= 3;
Color = tex2D( smpSource, Tex.xy);
Color.a = AlphaColor.a;
return Color;
}
technique tech_00
{
pass pass_00
{
VertexShader = null;
PixelShader = compile ps_2_0 ColorToAlpha_PS();
}
}
technique fallback { pass one { } }
I also tried [for testing] to set the Color.a to the Color.r value, which resulted in semi-transparent red-parts and fully visible rest oO
May I misunderstood the shader thing?
[FYI: The shader is applied via bmap_process and the image is created via bmap_createblack, 32bits. ]
I am also having problems with alpha in other shaders, but this is the most important
[I will learn from it^^]
Thanks in advance,
Marian