Re: Alpha blending multiple videos with jit.gl


Forums > Jitter > Alpha blending multiple videos with jit.gl
April 29, 2013 | 7:21 am

Thanks much Rob – that helps a lot! I’ve been digging into learning the wonderful world of jit.gl.pix; seems it can be very useful as I further develop the patch.

I’m sure there will be some things that will still need to be done with matrices, but it certainly seems that for speed’s sake I should do as much as possible on the GL side. One thing I’m trying do is distort the images and alphas something like the jit.repos-distortquad example. I’ve attached my revised patch showing how I’m using it – (See blue objects in the multilayer_stuff patcher.) Since I end up having to apply the distortion eight times – (4 videos, RGB + alpha for each), it slows things down. (And I’m still using it at 320×240 as in the original example – when I take it up to 854×480 it’s extremely slow.) It seems like that type of distortion effect might be fairly straightforward to do with jit.gl, but I haven’t found a similar example. I can imagine it could be done by distorting a textured mesh – but then I lose the alpha blending from the videoplanes. So perhaps a shader? Is there perhaps a similar example out there I’m missing? I’m not sure how to approach writing that from scratch.

Also, I had a couple other general questions about jit.gl.pix:

* Are there performance hits from daisy chaining too many jit.gl.pix objects? I.e. is it faster to combine shader functions into one jit.gl.pix object when possible, or is it ok to keep daisy chaining individual shaders? (I realize it’s sometimes necessary to use separate objects because of vectors vs. pixels).

* Is there a way to give jit.gl.pix objects names, so i can see easily in my code what each one does? A workaround of course would be to put them into descriptively-named subpatchers, but just wondering if there is a way to name them directly.

Re: jit.gl.hap – thanks for the suggestion – I played around with it some. Seems that it will really only help if I’m not doing any matrix operations on the videos, correct? As soon as I convert to matrix, frame rate slows down, which I guess makes sense. I also tried it without any matrix operations (i.e. the distort-quads) on the videos, but keeping the distorts on the 4 alphas. It didn’t seem to make much difference vs. doing the same with jit.qt.movie in uyvy mode – so I think the distorts on the alphas are bottlenecking it in that case.

Thanks very much again!