Using a png, along with xfade, to create a simple title card in jitter

aceslowman's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I've seen some similar questions on the forum, which either seem old or for Windows (I'm on OSX). What I want is a lightweight way to fade in a png over the top of my video, but can't seem to find an appropriate way using jit.matrix. There are still so many things I haven't tried yet with Jitter, so hopefully I can add this to my toolset soon. Here is the gist of what I'm working with (which seems to be just giving me a black screen):

Andro's icon

Not behind the computer but....
Send the movie to
Jit.gl.videoplane @blend enable 1 @ depth enable 0 @layer 2
Send the png to
Jit.gl.videoplane @blend enable 1 @depth enable 0 @ layer 1

You then need to change the opacity of both videoplanes with 1 float soooooo
Float 0.
Pak color 1. 1. 1. 1. ( plug the float in the 5 th inlet of pak, thats opacity)
Repeat this for the other videoplane but plug the float into a scale 1. 0. 0. 1. And then into the pak object.
This would crossfade
To just blend the png then only change its opacity and not the opacity of the other videoplane.
Hope this gets you going.

aceslowman's icon

Is there any way that I can do that with an xfade (using the gen xfade)?

Christopher Dobrian's icon
aceslowman's icon

I know how to mix videos together, I know how to use xfade, I just can't get the png to actually go into a jit.matrix. My confusion is with the png.

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.
aceslowman's icon

I've tried both of those options, I get either nothing coming through, or a white screen with black boxes, approximating the shape of the png. I set the resolution of the matrix, and it looked just the same:

Screenshot-2015-11-25-19.24.01.png
png
Christopher Dobrian's icon

On my MacBook Pro i7 running Mac OS 10.8.5 and Max 7.0.6 it works fine, including with the .png file you posted. It also works fine with screenshot .png files I create with the Mac OS. One difference I note between the two files (yours and the one I create on my Mac) is that yours has an alpha channel, whereas my Mac OS-created screenshot does not. Makes no difference here on my Mac; are you on Windows?

aceslowman's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I'm on Mac, and using jit.unpack, I finally just got plane 0 out, which properly displayed the png. Sorry if I had poorly explained things, I put together an example here that should show what I'm trying to do. I'm really new to GL, so sometimes it's hard to figure out when I need to be searching for GL solutions or jitter matrix solutions for things. Right now, the xfade is working, but it is failing to treat the second texture as an alpha layer. Any clue where I might be looking at this wrong? Should I be looking at layers instead of xfades?

Christopher Dobrian's icon

It depends on whether you're trying to have a layer of text superimposed upon an image, or are trying to crossfade from one to the other. I'm confused now which you're trying to do.

For mixing (combining two images together or crossfading from one to the other), you can use [ jit.xfade], or [jit.pix @gen xfade] or you can alphablend a videoplane in OpenGL. If you want to use the alpha plane of one matrix to make parts of it transparent, so that its opaque parts are visible but its transparent parts let another image show through, you can use [jit.alphablend]. (See Jitter Tutorial 29: Using the alpha channel.)

aceslowman's icon

What I would like is for the PNG to be able to be faded in over matrix 1, and have some sort of blending effect. Does xfade ignore transparency? I guess if you have xfade 1, it is no longer showing any data coming from the first matrix, only data from the second. I might need to look deeper into alphablending videoplanes: that might give me the most flexibility and assure that I don't leave GL. The link is a huge help, thank you Christopher.

metamax's icon

Austin, you can use [jit.gl.pix] to stay in GL. I have also been using [fpic] for loading textures into [jit.gl.pix] when using [jit.world] as I don't have to worry about the same image matrix getting continually banged.

Max Patch
Copy patch and select New From Clipboard in Max.

aceslowman's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Is there a way using this method to get blending effects between the two layers? Like exclusion or something, just using the png? It stops handling the transparency when I change the blend mode.

metamax's icon

Not sure I understand. Is the attached pic not the intended effect?

2_layers.png
png
aceslowman's icon

Sorry I missed your first post Metamax, jit.gl.pix and slab is going to be good for me to get acquainted with more. It is almost the desired effect, but I was wanting to see if I could do more with the blending, using different blending modes than just alphablend or alphaadd. Maybe this is something I should make a shader for, should be a simple shader to start with right?

metamax's icon

Adobe-style blending modes and Porter-Duff compositing operators can be combined to great effect.. and are easily ported to Gen.
This is a great resource..... http://www.w3.org/TR/compositing-1

blend-src_dest.png
png