How to make a smooth Alpha chanel keyboard with Silverlight 3 pixel shaders?

How to smooth alpha channel using Silverlight 3 pixel shaders?

I want some kind of HLSL filter (like this Shazzam HLSL example )

             sampler2D  implicitInputSampler : register(S0);


             float4 main(float2 uv : TEXCOORD) : COLOR
             {
               float4 color = tex2D( implicitInputSampler, uv );

             if( color.r + color.g + color.b < 1.9 ) {
             color.rgba = 0;
                 }

             return color;
             } 

in order to dial not only the color that I am trying to type, but, for example, if dark red consists of red and blue, and I type all blue, I want to get transparent red. (Probably, this picture can explain what I want) (source: narod.ru )From to image

+3
source share
1 answer

Looks like you just want to subtract the color and then pin it.

float4 subtract = ... ; // color you want to remove
float4 color = ... ;

color.r -= subtract.r;
... // for b and g

if ( color.r < 0 )
    color.r = 0;
... // for b and g

, , "" , . , , .

+1

Source: https://habr.com/ru/post/1722238/


All Articles