Posted: 15th Mar 2021 13:27
I wish to use a green screen effect on my video, so that the background shows through. Is this even possible in AppGameKit? Maybe with a shader?
Posted: 15th Mar 2021 19:16
Some discussion here. I would think you would need to process the video so it is transparent first but maybe the thred discusses some other approach.
Posted: 15th Mar 2021 19:26
you sure can the flaming hoop was just one of the times i did



sorry you need to fast forward a little

or perhaps the intro here
Posted: 19th Mar 2021 21:16
Nice! But how?
Posted: 21st Mar 2021 15:08
these commands
+ Code Snippet
PlayVideoToImage( imageID )
SetImageTransparentColor ( iImage, r, g, b )
SetSpriteTransparency ( iSpriteIndex, mode )
Posted: 25th Mar 2021 22:07
Is this even possible in AppGameKit? Maybe with a shader?

Yes. In fact you can do anything a professional editing software can do with shaders.

this is a simple agk greenscreen pixelshader
you need to render the video to an image as an input and apply the pixelshader and image to a sprite
+ Code Snippet
#define threshold 0.55
#define padding 0.05

uniform sampler2D texture0;
varying mediump vec2 uvVarying;
varying mediump vec4 colorVarying;
 
void main()
{

	vec4 greenScreen = vec4(0.,1.,0.,1.);
	vec4 color = texture2D(texture0, uvVarying);
    
	vec3 diff = color.xyz - greenScreen.xyz;
	float fac = smoothstep(threshold-padding,threshold+padding, dot(diff,diff));

	color = mix(color,texture2D(texture0, uvVarying) * colorVarying, 1.-fac);
	gl_FragColor = color;
}

Posted: 29th Mar 2021 17:13
[center][/center]

Very simple Green Screen 3D shader.

You can replace the example video with your webcam and be inside your game.


Mikko