Forums > Jitter

[bug?] jit.gl.node and alpha color message


August 26, 2013 | 6:37 am

Hi,

I have to send a color message, changing the alpha value, to a videoplane object.
Alpha does not seem to be linear via a jit.gl.node object.
It’s ok whithout using node.

I don’t understand why…. is it a bug ?

here is the patch (MBP retina, OS 10.8.4, Max 6.1.3) :

– Pasted Max Patch, click to expand. –

thanks

August 29, 2013 | 1:17 am

Nobody Knows ? …. the Trouble I’ve Seen… with alpha & nodes…..

August 29, 2013 | 2:14 am

i can notice the same here (osx10.6.8 max6.1.3), unfortunately i’m not too familiar with jitter nodes, so i can’t really help, but mayyybe it’s related to the default erase color of videoplane/node ? or some blending thing ?

September 2, 2013 | 12:01 pm

it looks like when you capture the first videoplane to the gl.node, it effectively premultiplies the alpha value into the texture, while still keeping the alpha channel. when you display on the second videoplane with @blend_enable 1, it applies the alpha channel to the already premultiplied texture, thereby giving your non-linear effect.

solution is to set @blend_enable 0 on second videoplane.

September 3, 2013 | 7:56 pm

Hi,
Thanks for your reply.

@Rob : yes, it look like an alpha premultiplies problem….
you solution is not good for me, i need to use alpha on second videoplane.

In fact, i try to use 32 gl.cornerpins routed to 8 sub-masters gl.nodes, routed to 2 masters gl.nodes, routed to the gl.render…. and i need to use alpha…
So in my case, the gl.nodes premultiplies twice the alpha value !
May be using nodes isn’t the right way ?

January 12, 2015 | 3:45 am

Hi, did anyone find a solution to that yet? I ran into the same problem and I can’t use Robs solution either. Thanks.

January 12, 2015 | 5:21 am

Hi,
Same probleme with Max7 / OSX 10.10.1
I need to use movies with alpha channel. So, i can’t use Robs solution (@blend_enable 0 on second videoplane)….. and i can’t use jit.gl.node….
Hope somebody find a way to do that…
Thanks

January 12, 2015 | 8:15 am

you will have to come up with another technique for this. why do you need to cascade textures using gl.node like this, rather than simply combining the textures using gl.pix or gl.slab? please post a patch.

January 12, 2015 | 9:55 am

Hi Rob,
Here is the patch. I try to use gl.node to have "layers" route in some "subs".
Thanks again !!!

`

– Pasted Max Patch, click to expand. –
January 13, 2015 | 8:20 am

Hi Rob, we try to create hierarchical rendering groups while preserving the alpha channel. I cannot post a patch since my project is pretty large and part of the rendering process happens in Java. I tried capturing to a texture (texture with erase_color 0 0 0 0), but it has the same effect. I have an unknown number of videoplanes and I need to combine them to a texture. Can you give us a hint on how to achieve this while preserving the alpha channel.

Thanks, David

January 13, 2015 | 8:39 am

i would just adjust your alpha control. the alpha is essentially being squared by the time it reaches the sub layer, so simply send your alpha parameter through a sqrt 1. object to invert that.

you may also want to establish which videoplane sub layer is the first layer (using the @layer attribute) and set @blend_enable 0 on that videoplane, otherwise the erase_color blends in, which may be undesirable.

another option would be to build in additional functionality that handles the alpha channels, using jit.gl.pix. you could route all alpha channels of a sub-node to a jit.gl.pix and apply them however you want to the final output of that sub-node.

January 13, 2015 | 9:26 am

Hi Rob,

i would just adjust your alpha control. the alpha is essentially being squared by the time it reaches the sub layer, so simply send your alpha parameter through a sqrt 1. object to invert that.

Yes of course i can use a sqrt object. But like that, i can’t directly draw to the render object. i need to use a gl.node just to correct the alpha linearity…. It is not a very ‘elegant’ solution…

you may also want to establish which videoplane sub layer is the first layer (using the @layer attribute) and set @blend_enable 0 on that videoplane, otherwise the erase_color blends in, which may be undesirable.

Yes

another option would be to build in additional functionality that handles the alpha channels, using jit.gl.pix. you could route all alpha channels of a sub-node to a jit.gl.pix and apply them however you want to the final output of that sub-node.

Yes but…. Is it an ‘elegant’ solution…

Thank you very much for these options

January 13, 2015 | 10:32 am

Hi François,
An another thing with "jit.gl.node" the default color is set to "0.5 0.5 0.5 1.".
If you set "@color 1 1 1 1" on "jit.gl.node" sometime it can be usefull with "blend_enable 1" .
mathieu

January 13, 2015 | 11:20 am

Thank you Rob for your insights. I’m sure the answer is already there, but I cannot figure out what to do with it. If you find the time to have a look at it, I made a patch, that explains, what I’m trying to do.

– Pasted Max Patch, click to expand. –
January 13, 2015 | 4:50 pm

This is how I solved it in the end. Maybe it is of some use for someone.
Thanks to Francois to point that problem out (I hope you find a solution that fits your needs) and thanks to Rob for giving me the right pointers.

– Pasted Max Patch, click to expand. –
  • This reply was modified 4 months by  django.
January 16, 2015 | 4:25 pm

Hello all
I am having similar problems with the alpha and gl.node. I don’t know if I could have done this composition differently. I hope someone can point out what I can do. I have tried correcting the alpha with gl.pix.

My goal is to create a trail effect on a sprite mapped over a gridshape object moving over a background image and not have the top sprite blurred.

thanks for you help !

Here’s the link to the patch and images
https://www.dropbox.com/sh/plzjlhlth5ph800/AABTpbBXdChbTbHHATdwlpnZa?dl=0

Viewing 16 posts - 1 through 16 (of 16 total)

Forums > Jitter