Alpha channel work WITHOUT Alphabend **I want control !
Hello Jitter friends!
I want to have control over the alpha channel. Essentially I want to chose areas within the matrix to make transparent and other areas to be at full opacity. So, I'm testing out a method with jit.unpack and jit.pack to first ensure that I even have an alpha layer, then I am trying to control the opacity with an operation on that layer with jit.op (Doesn't seem to work)
I don't want alphablend because it doesn't seem to provide any control over which areas are transparent or not.
Am I dealing with this incorrectly? Something I am not understanding about alpha?
I thought I would be able to create a matrix with 0 and 255 in different coordinates and use that as a transparency map by multiplying it to a movie clip passing through jit.op, but nothing seems to be working as desired.
here is a patch of the first test
Thanks for any help and or direction !
I'd say that, yes, you are not understanding the alpha plane correctly.
Think of the alpha channel (plane 0) as containing the level of 'opacity' of each pixel. You still need to use jit.alphablend to alphablend two videos; jit.alphablend uses the plane 0 value of each pixel of the left video to determine how fully it will occlude the corresponding pixel of the right video. A value of 0 means fully transparent (lets the other video's pixel show through entirely) whereas a value of 1 means fully opaque (completely occludes the other video's pixel).
See Jitter Tutorial 29 Using the Alpha Channel, and see also the example titled "mask by alphablend" on this page: http://music.arts.uci.edu/dobrian/IAP2006/examples.htm
P.S. Using two jit.gl.videoplane objects is even easier and more computationally efficient. Send the matrix with the desired alpha channel information into [jit.gl.videoplane @depth_enable 0 @blend_enable 1 @layer 1]
P.P.S. Search something like "alpha channel mask opengl" in the forum for a garden of educational delights.
sweet, that makes enough sense for me to explore that avenue, but I still don't understand why I wouldn't be able to perform an operation on that plane 0 through jit.op
The way you're implementing the jit.op object isn't doing what you need done.
To perform DIY alphablending (with jit.op rather than jit.alphablend) you'd need to multiply one video by the (1-plane) matrix of alpha values you want (for each pixel), and multiply the other video by the opposite opacity (255 minus the alpha values you want), then add them together. (That's what jit.alphablend does, using the plane 0 values of one of the videos.)
Here are some examples.
1) Constructing a 1-plane matrix with the desired alpha mask, packing it into plane 0 of one video, then sending the two videos to jit.alphablend.
2) Constructing a 1-plane matrix with the desired alpha mask, multiplying one video by that, and the other video by 255 minus that, then adding the two results together. (Same effect as No. 1.)
3) Just for fun, this example uses 255 minus the brightness of one video as the "alpha" mask of the other video.
Thanks for the examples! I'll try to work something out from here!
(is jit.movie a max 7 object? I don't have such an object on 6 but I just replaced it with jit.qt.movie)
Yes. And [jit.*] is the same as [jit.op @op *], etc.