Page 1 of 1

Alternative to chromakey fast

Posted: Mon Jun 21, 2021 1:26 pm
by frank_halfwong
Hi,

I've been searching MMV's forums, found a bunch of GLSL shaders (chromakey.txt and chromakey2.txt) as alternative but the result isn't perfect. Is there a simple solution in MMV that will match the "chromakey" features in OBS?

At the moment, i need to chromakey in OBS, add a solid perfect green and Spout it to MMV. Then in MMV, use chromakeyfast, do my visual transformation, and Spout out it back to OBS. Until i can chromakey directly my webcam in MMV, I'll have to continue this technique... but this is CPU hungry.

I've found some interesting thing on MMV GLSL shaders: https://magicmusicvisuals.com/forums/vi ... a+key#p749
Lumakey for sky :https://magicmusicvisuals.com/forums/vi ... +key#p9042

Any other leads to fix my issue?

Thanks!

Frank

Re: Alternative to chromakey fast

Posted: Tue Jun 22, 2021 2:08 pm
by Magic
Did you try the Chroma Mask module I recommended before?

Re: Alternative to chromakey fast

Posted: Tue Jun 22, 2021 2:40 pm
by frank_halfwong
Yes, but I couldn't then restack the original area with over the masked portion. The module did an amazing job at isolating my "body" but then that's just a black mask. You talking about the chromakey.txt GLSL?

Frank

Re: Alternative to chromakey fast

Posted: Tue Jun 22, 2021 6:50 pm
by Magic
Add > ISF > Masking > Chroma Mask

Re: Alternative to chromakey fast

Posted: Tue Jun 22, 2021 8:57 pm
by Terry Payman
Perhaps just "finger trouble", but I could find no combinations of settings of the Chroma Mask module that would work in the conventional manner of a chroma key. The best I could achieve was to replace the keyed colour with opaque black rather than transparent black. I think this is the issue found by the OP.

Unlikely though it seems, I believe there's a bug in the coding (EDIT: or an omission of an obvious option to allow alpha keying as well as removal of colour) . The option "Show Alpha" displays the internal float totalAlpha, so the module appears to be keying correctly. However, the "Apply Alpha" option is coded to always apply 1.0 as alpha rather than totalAlpha so the output is never transparent.

Attached is a quick hack that fixes the above, plus it substitutes HSL for RGB to facilitate selection of the chromakey hue. I've also tweaked default values of "Apply Alpha", "Hard Cutoff", "Dilate" and "Blur".

It now works for me, although I'm certain it can be improved.

Re: Alternative to chromakey fast

Posted: Wed Jun 23, 2021 1:52 pm
by frank_halfwong
Thanks to both of you. I'll try the two methods. @Terry, once again thanks for your custom modules.... wow. I'll let you know how the result is.

1000x thanks

Frank

Re: Alternative to chromakey fast

Posted: Tue Jun 29, 2021 1:55 pm
by frank_halfwong
Ok Terry, your custom module works GREAT!

Here's my setup for others if they want to give it a try.

Thanks again, I don't have to do the OBS to MMV to OBS setup anymore!

Frank

Re: Alternative to chromakey fast

Posted: Tue Jun 29, 2021 1:58 pm
by Terry Payman
Cool! :D
Many thanks for the update Frank!