Forums > Jitter

Multiple Shapes

February 25, 2009 | 4:53 am

I’m sure this seems like an easy question, so if someone could point me in the right direction I’d greatly appreciate it.

I’m having trouble wrapping my head around how to control multiple gridshapes. Essentially, all I want to do is have two squares on the screen, one in front of the other, with distinct control over both squares (colour, position, etc). Everything I do with regards to layers, blend modes and such only seems to allow one square to be visible. What am I doing wrong?

February 26, 2009 | 10:55 pm

your question is less one of displaying multiple gridshapes and more one of compositing textures. you are capturing each gridshape to a texture, you should then use a slab with one of the compositing textures to decide how to blend the two textures you captured to.

a possible better solution is to capture both shapes to the same texture. using the drawobject message is very helpful for this. let the sketch draw the two objects into one texture, and perform your post processing on that one texture instead of two.

March 18, 2009 | 4:13 am

I’m a little bit further along, but the problem is that I can’t seem to find a blend that treats the black space around the shape as transparent. I would still like to have control over each shape’s blur amounts, so that’s why I’m still capturing to two different textures.

In this example I’m using a slab for blending, but I’ve also been able to accomplish the same thing using different videoplanes and blend_mode. I can only seem to find blending modes that add the two shapes’ colour together in different ways.

What I want to happen is for the shapes to be completely opaque, and the part that isn’t the shape to be completely transparent.

March 18, 2009 | 7:33 am

yeah, alphablending on texture captures is kind of tricky. fortunately we have folks like the great nesa to illuminate the way…

in your patch, you merely need to:
-use the "reset, glclearcolor 0. 0. 0. 0., glclear" trick
-use the co.alphablend.jxs compositing shader.

also, check in nesa’s patch the "proper alpha channel capture" subpatch, that shows a great trick for debugging your textures by rendering them to a jit.matrix

– Pasted Max Patch, click to expand. –
March 23, 2009 | 3:55 am

thanks – this is a great help.

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

Forums > Jitter