how to overlay many images with alpha channel transparency
Hi all, I’ve done quite a bit of trawling but cant find the information I need – its probably elementary and I just cant see the wood for the trees.
I want to layer images over each other, with each layer using the alpha channel to control the transparency as an image sits over the previous layer(s).
Is it the blending flag, in which case would anyone be so kind to provide a working example? Do I have to scale the RGB values by the alpha channel? I’m a bit lost – help!
here’s an example i give my class:
----------begin_max5_patcher---------- 1338.3ocyZt0ahiCE.9Y5uBKz7vtqZQw2B3UiVM6eh8kUUiLDWHyjKLIlocm Qy+801woj1BT6jfgVURsSHbNe9bymvOuYxzkkOIpmB9Sv+BlL4m2LYhYJ8DS rimLMm+zpLds4xltpLOWTHmday4jhmjl44IIoEqAxMB.Oa6FNHmW+Uvc28Ws W4CkEx5zeHzWMDNKxN8Vtb0F067yUhUxFAgDoNKfzb.FaNfTuBt29dJ1kmVj IjFIBZmLMwHGkK+xcXb2OzBdt4Cc5+HpR3E7o6uKk6js2lH8j+5lazub6.Yw Gu6NfbWUAnr.jVHEUaAOTVYXigJ+1CBtZPkRs+812bVZgXU4tByc.4MyPvFL 0b.hw5C5WcGZvKOzpWwyDOyI+sbvTi5aO.gwda5fXWATPTX7kx4xpzm.OlJ2 .T+250hp93L0XXX8lXK7GIzq.j7He6VMSpDI.dQBXY1NAXaFuPE8pulIjAvD RXXRg3Q0G2aPhDrrctlO.4+sUznaSWxKVO8YEwcnzFn0FHoGtNQ9yD33wjrR dhQ2GavPaHB17ZLzetDFr7PVo5lbTsWcZtx2xQLnznzb0cSa1teR9SsSdZ2q ntQgo9m+lziTQnwyR5KoxYkaAeR82e.9z24YJ08nbUcwetIPsFt8xwi0fq4M QiPrSyKzARcyBCujkqWmINJJR0Eub+6pnsQX5QccKFO2kbQcMes3MK91509. 7np4.ViQzNAQfK7YINNLQQNFVpExUhLkmf5WsGAhRuEbxvs8BS1xWs0uQl6O mHggS5XDaeLsHo7wiSfWDP3fAJ63OrnwzvK+ATPhEZqCEBVsgWAv.74LXn0B XgMXHx+fDQWzjGpRy.YmtFjdhFLoak7pXHTeKDAewSq9JSITjVcN+4VQrtwU 7BZP1EGZa4q9JfbFojMsDoYG.vn3YTFlfmeJTQN.phu3nZWgWvx8QCAqHa2H PyhYQKhH9ZA1i8eSuTozr5L0lZCuuGdNquyChkhoIkKyDEImeGKZjsdlHuKs OPtTixZOg0sis8ndF53oPGqN1JAOAjT9CQ0r7xu6awqnS1oMaMKMUvvHdW65 gKc8uqR4Ym8tmnM.9lTyjTw3jW1IVY6.GD6eYd9BqKlaQa2n6saALTtEo0aD 0iteAMxzQi3EyX5ePJeCl29Fvf3bbT7vkhdzRfS6BPnuBKjX+wBNDXYDZsnK nPELvfh3d0zPHJDQDT2gk6eLLGrEXuWOVoLJbw7SDuXQ7HPCXPnwUQxD6FiG PxDXzEjVeKWHqJAm.Q80uxBlNgXhodWAJKDQXFXmksJZGWldzcYGZtr4dYdT 8u56LgQlzy+RcrtbW0pVknsC1f8hThnVlVvkokEcun3WbQaRSRDlyu+oyjrs TwDqP.t+fD2YYJ1AYR2FjPJSQmAYBBYldlMuosxr8iFpzRbYUM55if5FHGPY R2IC.98VU0livvJSPWjIbvjIciZGcqeL4LY8aj12kfTOkVloy+DaxbpQZMiF 55sK9EuZAHH1fHWrAQgSlbIqPfST4nD4QvCxhFCqFqMrZy4siFnr5B8le0QO ZPkHlKYn5UPN62+Q6pKDO7vFjwWVCQfLXXEIWnDzy5fTaVVuHxHOuIF6h7yy LToF4hTG3EW7YfjDJ47RRW1bC6pKDCLrElCgNRovUCrSN.jfRIWDIhuARLF6 TXyijy77Ydw.VbmjF5AAPGvmIk.N+MCfMemds6B1LZnIEcwTFGVaYm5vBJrt 7nnqv9C3TnQOKv2tqRBMt6t1nC2RCxb0RquDTM3W27+PlSYSK -----------end_max5_patcher-----------
Thanks for the reply and the patch, much appreciated.
I’ve had a good fiddle around with jit.alphablend, and still cant work out how to achieve the effect I want. I want to do something like this:
So not to blend images, but to stack them up with some pixels "see-through".
My concepts of video processing are probably a bit amiss, I’m very good with sound but fairly green to graphics and even photoshop etc. If possible it would be great to know a way to stack videos via a junction with multiple inputs, rather than a two way box. Curse demanding feckless newbs.
Sounds like a job for luminance keying. Check the examples/jitter-examples/video/keying subdirectory in the Max5 Folder- specifically the jit.lumakey- examples.
Do the images have an alpha mask? If so, jit.alphablend is exactly what you need. For three layers, you will need 2 jit.alphablend objects. If not, you will need to do some sort of keying.
Alpha blending can also be done using OpenGL with several jit.gl.videoplane objects with @blend_enable 1.
Many thanks for the helps.
It seems jit.lumakey is giving me an instant result to work with, which is great for learning some stuff. I cant quite work out how to do it with jit.alphablend but I have not given tutorial 29 its due attention. How come transparent regions of my png image are not transparent out the box? I need to read the info that is in the manual about alpha masking.
I’d really like to use jit.gl.videoplane though I spent quite some time messing around with this and not really getting very far, anyone know any relevant examples for alpha compositing with jit.gl.videoplane? If anyone has the time and willingness to construct me an example patch I’d be eternally grateful!
I posted a patch on this thread that might help you.
Forums > Jitter