"Picture in picture" alpha blend

ericsinger's icon

I'm trying to put a small matrix (320x240) in the center of a large one (640x480) and use the alpha channel of the smaller one to fade it in (from 0. to 1. transparency). To do this, I'm sending the large one into a [[jit.matrix 4 char 640 480 @dstdimstart 160 120 @dstdimend 480 360]], with [usedstdim 0] and [thru 0], then, the second one with [usedstdim 1] and [thru 1].

When I ramp the alpha down to zero by multiplying it by a 1.->0. float using [[jit.op @op * pass pass pass]], I would expect it to fade out. However, I'm getting a black box, as if jit.matrix is ignoring the alpha channel. I've tried jit.alphablend with no results, but I'm probably using it wrong. Ideas?

Rob Ramirez's icon

hard to say without seeing the patch, but strongly recommend you use opengl for this. 1 jit.world and 2 jit.gl.videoplanes are all that's needed.

Christopher Dobrian's icon

For the old-school jit.alphablend method, see http://music.arts.uci.edu/dobrian/IAP2006/examples.htm and scroll down to the examples called "make a mask image" and "mask by alphablend".

phiol's icon

hello ericsinger

here is a patch doing what you ask for , hope you learn from it :-)

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