Previous topicNext topic

Alternative to chromakey fast

Questions, comments, feedback, etc.
Post Reply
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Alternative to chromakey fast

Post 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
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Alternative to chromakey fast

Post by Magic »

Did you try the Chroma Mask module I recommended before?
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Alternative to chromakey fast

Post 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
Magic
Site Admin
Posts: 3440
Joined: Wed Apr 09, 2014 9:28 pm

Re: Alternative to chromakey fast

Post by Magic »

Add > ISF > Masking > Chroma Mask
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Alternative to chromakey fast

Post 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.
Attachments
Chroma Mask TP.fs
(11.3 KiB) Downloaded 301 times
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Alternative to chromakey fast

Post 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
frank_halfwong
Posts: 44
Joined: Wed Apr 21, 2021 5:22 pm

Re: Alternative to chromakey fast

Post 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
Attachments
ScreenHunter_240 Jun. 29 09.54.jpg
ScreenHunter_240 Jun. 29 09.54.jpg (38.53 KiB) Viewed 6325 times
Terry Payman
Posts: 710
Joined: Sun Sep 14, 2014 8:15 am
Location: UK
Contact:

Re: Alternative to chromakey fast

Post by Terry Payman »

Cool! :D
Many thanks for the update Frank!
Post Reply