Forum

Address Pin Border Mode Alpha hlsl

Hello I was trying to add a sampler state pin to a constant shader to get it in border mode and color as alpha. is it posible ?

having a look to some older threads i got the address in border mode inside the shader but alpha seems not to work.

sampler Samp = sampler_state    //sampler for doing the texture-lookup
{
    Texture   = (Tex);          //apply a texture to the sampler
    MipFilter = LINEAR;         //sampler states
    MinFilter = LINEAR;
    MagFilter = LINEAR;
	AddressU= BORDER;
	AddressV = BORDER;
	BorderColor = float4(cBord.r, cBord.g, cBord.b, 0);
	
     //BorderColor = (cBord);
};

i saw that the drawfixed node has an sampler state pin but changing the color to alpha does not get the alpha either.

as i remember i had it working but there was something i don’t remember

hi with drawfixed works with .png at 16bit and dds with interpolated alpha. i could not make it to work with normal shader yet. cheers

try replace BorderColor = float4(cBord.r, cBord.g, cBord.b, 0);
with BorderColor = float4(0, 0, 0, 0);

float4 cBord : COLOR <String uiname="Border Color";>  = {1, 1, 1, 1}; //important to define the color before the sampler
sampler Samp = sampler_state    
{
    ...
    AddressU= BORDER;
    AddressV = BORDER;
    BorderColor = (cBord);
};

and

pass P0
{
    VertexShader = compile vs_2_0 VS();
    PixelShader = compile ps_2_0 PS();
    SrcBlend = SrcColor;
    DestBlend = DestAlpha;
}

not sure though, if scrblend + destblend is the same as the ColorAsAlphaAdd blend mode

hello guys, thanks for replies , yes woei,s way worked ;D
lasal also apreaciates it and thank you.

note: i had to reset the shader as only saving the shader it did not get it