@capture and alpha channel

Oct 28, 2008 at 11:53am

@capture and alpha channel

Hi,
I’m trying to do some painting stuff using slab feedback and @capture to texture. The problem is that the alpha channel is always set to 1 before capturing (see the patch in attachment). Is there a way to set the alpha channel of the texture to 0 before capturing?

Otherwise, does someone knows which shader to use to have the same effect that drawing into jit.gl.render using erase_color 0. 0. 0. 0.?

Jean-Michel

In attachment, a patch and a shader I’ve create to do the feedback despite the alpha channel problem. I’ve change the blend mode in order to invert the alpha of my drawing texture.

#40541
Oct 28, 2008 at 1:22pm

I think this patch achieves what you’re looking for. It uses a shader written by Wesley that was posted to the forum some time ago.

pelado

#143548
Oct 31, 2008 at 10:34am

Thanks for the tip.

However, I need to have the alpha channel to 0 before starting to draw, for example to draw over a video. And I cannot use chromakey or another technique to re-build the alpha channel because I want to be able to draw with any color.

Any idea?

I’ve seen this problem (but with to_texture) in another post, without answer:

http://www.cycling74.com/forums/index.php?t=msg&goto=141490&rid=0&S=c4705b6b4676af8cdda64dc9b55e8154&srch=capture+texture+alpha#msg_141490

JM

#143549
Oct 31, 2008 at 1:23pm

I’m not sure that I understand what you want to do. If you want to have a movie in the background which only shows through where the mouse is positioned, you could try using a composite shader (multiply?) like in the attached patch.

pelado

#143550
Nov 14, 2008 at 9:56am

If I understand JMC correctly, I’m having a similar problem which I can’t seem to figure out even after look at your patch Pelado. I am rendering shapes to textures using the same method to apply a glowing effect using slab, but I want what is behind the shape to have an alpha channel of 0. Is there a way to do this without resorting to a jit.unpack?

-Paul

#143551
Nov 14, 2008 at 4:13pm

Paul, I still have problems understanding what you want to achieve! I see
your glowing shape, and I can see the texture behind it if I disable the
glowing shape. When you say you want the alpha channel set to 0, I start to
lose you. Do you mean that you want to blend the two textures? If you want
to mix between the two, you can enable blending for both videoplanes, and
use the alpha values to mix between the two.
Or if I still misunderstand then can you explain what you want to achieve
and why you want to set the alpha channel to 0?

pelado

http://www.pelado.co.uk

On Fri, Nov 14, 2008 at 10:56 AM, Paul T wrote:

> If I understand JMC correctly, I’m having a similar problem which I can’t
> seem to figure out even after look at your patch Pelado. I am rendering
> shapes to textures using the same method to apply a glowing effect using
> slab, but I want what is behind the shape to have an alpha channel of 0. Is
> there a way to do this without resorting to a jit.unpack?
>
> -Paul
>

#143552
Nov 14, 2008 at 5:37pm

Hi Pelado,

Thanks for your quick reply! I would like to enable blending for both videoplanes, and use the alpha values to mix between the two. Basically, I want to see the glowing cube simultaneously with whatever is behind it–in this case it’s another videoplane with some text but ultimately I want multiple background objects. So in my example patch, I want to see a glowing cube which reads “Can you see me?” right above it.

What I don’t understand is how to blend the two since I’m starting with all OpenGL rendering. Changing the alpha channel of the cube gridshape to 0. using the color attribute doesn’t solve the problem because drawing it sketch seems to change the alpha back to 1. Besides, if it did work that would just make the cube transparent and that’s the opposite of what I want. Changing the color of sketch or the videoplane isn’t what I want either because that would change the alpha level of the whole surface, not just the space around the cube. I know that I can convert to a matrix and then use jit.unpack/jit.pack to insert whatever alpha channel I want, but I was just wondering if there is a way to avoid this to save processing as my main patch is already quite expensive.

-Paul

#143553
Nov 14, 2008 at 8:02pm

If you draw the cube behind the other objects then you might get away with enabling blend on just those planes that are in front of it like in the attached patch.

You could try different blend modes and possibly render your textures on black backgrounds to help with the blend as I did in your patch. Its a bit difficult to say exactly, because I don’t know what you’re doing, but maybe that helps?

In terms of efficiency have a look at using display lists, setting the dim for the videoplanes to 2 2, and using a dim size for textures that use just the area you want to cover – in your patch you create a texture that is at least eight times the size of the text that you are using.

Ask again if I’ve completely misunderstood what you are looking for.

pelado

http://www.pelado.co.uk

#143554
Nov 16, 2008 at 1:45am

A ha! Thanks very much Pelado!!

-pt

#143555

You must be logged in to reply to this topic.