Chroma key source code - user Digitalfragment

Started by
4 comments, last by wesleybobato 8 years, 4 months ago
Hello guys
I found an error in this code because manhattanDistance need 2 parameter
what would be the second parameter (RGB1 and RGB2)
float dist = smoothstep (0, threshold, manhattanDistance (chromakeyColor, ??????));
float manhattanDistance (float3 RGB1, RGB2 float3)
{
float3 dist3 = abs (RGB 1-RGB2);
return dot (dist3, float3 (1,1,1));
}
float4 chromakey (float3 pixelrgb, float3 chromakeyColor, float threshold)
{
float dist = smoothstep (0, threshold, manhattanDistance (chromakeyColor));
float alpha = 1.0 - saturate (dist);
return float4 (pixelrgb, alpha);
}
Thanks for listening.
Advertisement


what would be the second parameter (RGB1 and RGB2)

float dist = smoothstep (0, threshold, manhattanDistance (chromakeyColor, ??????));

It should be 'pixelrgb', as the whole idea of chroma key is to compare pixel color against selected color key.

Thank you for your answer.
You have something to Chroma Key to please help me?
Thank you so much


You have something to Chroma Key to please help me?

Sorry, I don't get what you're asking.

If you need material to test your sw, ask google about "green screen".

There was a lot of samples, including Van Damme pretending shooting, Shia LaBeouf yelling "do it", etc.

ok

Thank You For your Attention.

Have a Nice Day.

A Help With My Code does not work

please

float4 main(float2 uv : TEXCOORD) : COLOR
{
float4 color = tex2D( inputSampler, uv ); //Capture image Colors...
color.rgb = RGBtoHSL( color );

float3 colordistance = chromaKey( color.rgb, RGBtoHSL( float3( 0.47, 0.98, 0.00 ) ) , 0 );

if ( all( abs( color.rgb - colordistance.rgb ) < ( Tolerance ) ) )
color.rgba = 0;

color.rgb = HSLtoRGB( color ); //Convert HSV to RGB...
return color;
}

This topic is closed to new replies.

Advertisement