jit.gl.model to jit.gl.slab alpha transparency not working

Andro's icon

Hi Everyone,

I'm sure the answer to this is really simple. I need to overlay two jit.gl.slab effects. The chain is as follows.
jit.g.model connected to jit.gl.node (@capture 1) this outputs a texture which go's to 2 jit.gl.slab objects (eg. lumadisplace and kaleido). I tried putting them both into co.alphablend.jxs and co.alphaglue.jxs, no joy
The final result then gos into jit.gl.videoplane. This then outputs to a jit.gl.render object

This all works great with one slab so the chain(s) works, thats confirmed. I am just so stuck with this, i've tried depth disable/enable, blend enable, trawled the forums and tuts, I just ain't getting it.

I know it has to do with Depth enable and blend enable and blend modes, still no joy.
Could somebody tell me how to set up alpha transparency with open GL in general.
Final aim is 2 seperate jit.gl.models going through chains of jit.gl.slab and finally being merged together with full Alpha transparency.
Any and all help is greatly appreciated :) And of course an example patch of the simplest kind would be a life saver.

Rob Ramirez's icon

post a patch

Rob Ramirez's icon

for transparency you want:
@depth_enable 0 @blend_enable 1
then you control layering with @layer
if you are capturing, you want to set the gl.node @erase_color 0 0 0 0 in order to capture with transparent background.

Andro's icon

The forum won't let me paste and upload the " copy compressed " code :(

Andro's icon

Then i'll try uploading it as an attached file.

012_3dModel_SlabAlphaProblem.zip
zip
Andro's icon

I'm not sure if the 3d models (nothing special) have also been included. This is the 1st time I've uploaded something to the forums. If I need to alter anything or include something then just point it out and I'll do my best to make it happen.

Rob Ramirez's icon

the problem is the two slab you are using both set the output texture alpha channel to 1, thereby preventing you from alphablending properly.

you can determine this by hooking the output up to a jit.matrix, and then to a jit.unpack, and viewing the first outlet of the jit.unpack with a pwindow. that is the alpha channel of that texture.

in this particular case, where you have two textures on a black background, you can simply add the two textures together with a jit.gl.pix object.

otherwise, you will have to re-create your alpha channel, possibly using one of the color planes, or the calculated luminance of the color planes.

Andro's icon

Hi Rob,

I've finally got it to work thanks to your advice :)
jit.gl.pix is an incredible object but I don't think I'm good enough yet with Jitter and equations to do the basics.
I also figured out how to send chain 1 to one jit.gl.videoplane and the 2nd to another jit.gl.videoplane.
This allows me to mix jit.gl.slabs upfront and decide if they're on layer 0 or 1. I'm going to post a patch in a few days with both techniques so anyone else hitting this problem can get it solved quickly. As always thanks for the guiding tips. They're a life saver !

antialias's icon

If you were able to post the patch with these techniques I'd appreciate it!

Andro's icon

Hi Antialias,

I'm not behind my regular computer right now but just check the jit.gl.pix examples in the cycling 74 folder.
the file name is jit.gl.pix.alphablend.maxpat.
Works instantly if your alpha data is correct.