Page 1 of 1

new "mask" module not behaving

Posted: Tue May 19, 2015 7:08 pm
by blackdot
hi there, i noticed that the new mast module is not hehaving as expected (look at whole image):
weirdmask.jpg
weirdmask.jpg (180.08 KiB) Viewed 10225 times
-> although the mask cuts out the colored picture, it doesnt make the black transparent, therefore the white polygon isnt visible in the background.

FYI, the custom GLSL shader "AlphaMask" from the tutorial forums works as expected. this one:

Code: Select all

void main()
{
    vec2 pixelLocation = gl_FragCoord.xy / iResolution.xy;

    gl_FragColor = texture2D(iChannel0, pixelLocation) * texture2D(iChannel1, pixelLocation).rrrr;
}

Re: new "mask" module not behaving

Posted: Tue May 19, 2015 8:43 pm
by Magic
Actually the Alpha Mask shader in the Tutorial forum is the same as the Mask module.

What you posted is this one I modified slightly here: viewtopic.php?f=2&t=355&p=1437#p1437

The issue is masking using brightness vs. masking using alpha. The Mask module uses alpha, so you would need a mask with an alpha channel in the area that's supposed to be transparent.

Or if you want you can just add the ".rrrr" to the Mask.fs file (in the Modules\Layers folder), if that's easier:

Code: Select all

void main()
{
    gl_FragColor = IMG_THIS_PIXEL(inputImage) * IMG_THIS_PIXEL(inputImage2).rrrr;
}
Or you could copy Mask.fs to a new file and modify it there, so you have both options. That's probably best. But keep in mind that, with the ".rrrr", the mask must be the second input. (In the Mask module, the input order doesn't matter.)

Re: new "mask" module not behaving

Posted: Tue May 19, 2015 9:21 pm
by blackdot
Hm okay. thanks. I was assuming, that we're using masks so we dont have to use alpha channels in videos :P.

Re: new "mask" module not behaving

Posted: Tue May 19, 2015 9:28 pm
by Magic
Well actually it's more efficient to use videos with alpha channels :). Because then you don't need the Mask (which uses extra fps/vram/etc.).

It's always best to use as few modules as possible to achieve the result you want.

In fact, if you have a fast hard drive (like an SSD), it might be worthwhile to export some Magic effects directly to .mp4 videos, and then import those videos back into Magic. But that depends upon whether the effects parameters are linked to live audio or MIDI, because in those cases, obviously you can't export videos. And you wouldn't have transparency with an .mp4. And you'd probably need to do some performance testing to make sure you're getting an overall benefit. I wouldn't do it unless the fps is consistently dropping below 60, or if VRAM is running really low. But it is a viable solution for people with older/slower computers. Anyway, probably more information than you needed :).

Re: new "mask" module not behaving

Posted: Tue May 19, 2015 9:45 pm
by blackdot
you have mentionned that before, that alpha channel videos are more efficient. my personal experience with them was rather difficult though. the one video format with an alpha channel i'm able to produce, is as said, with the video-png codec. unfortunately it seems to be kinda lostless, so filesize and bitrate get huge quickly, thus magic has more trouble playing it fluently (even more so in combination with the mix module). therefore the fps drop with those png-videos was much higher than using video masks.

Re: new "mask" module not behaving

Posted: Tue May 19, 2015 9:48 pm
by Magic
Ahh, true. I forgot about that :). Ok so maybe I do need to make a permanent adjustment to the Mask module. Or perhaps add an option to do it either way... yeah I think that would be the best.

Re: new "mask" module not behaving

Posted: Tue May 19, 2015 10:01 pm
by blackdot
i can just use that modified GLSL shader or do the thing to the module file you mentionned, that's fine.

Re: new "mask" module not behaving

Posted: Tue May 19, 2015 10:03 pm
by Magic
Ok :). But I'll still make the change in case any other users have a similar situation in the future.

Re: new "mask" module not behaving

Posted: Wed May 20, 2015 2:34 pm
by blackdot
using the QT/QT combination on creating alpha channel videos actually made it possible to recreate my experiment wich 900fps instead of 70fps where i used masks. so i guess alpha channel is on the table again :).