jit.gl.pix - simperimposing textures/matrices - how to
Hi all
Being the noob w. jit.gl.pix that I am,
I was wondering if it is possible to superimpose
layers (textures/matrices) using jit.gl.pix exclusively.
Here is a link:
https://www.dropbox.com/s/6nj63afdevyd27h/vignette%20%26%20layers%20jig.gl.pix.zip?dl=0
to a folder containing 2 patches, that demonstrate
how I've contoured and solved the problem. But they also demonstrate
that I wasn't able to use exclusively jit.gl.pix to layer a texture and matrix.
The patches explain way more clearly what I'm talking about
and want to achieve.
Thanks to everyone for your help
learning jit.gl.pix
phiol
layering gl-textures is done in one of two ways. either with fixed-function blend modes, or with shaders (gl.slab, gl.pix).
for ff blending, you use gl.videoplane (or gl.cornerpin, or...), set @depth_enable 0 @blend_enable 1, control the draw order with @layer, and control the blend function with @blend.
for shaders, you can use gl.pix (or gl.slab, but that requires writing a shader or using one of the built-in shaders - check out all the co.*.jxs shaders for examples). the default gl.pix gen patch does a simple additive blend. changing the + to a * makes it a multiplicative blend. loading gl.pix @gen alphablend does an alpha blend. once you start editing the gen patch, the possibilities are endless.
your link links to a movie file, not patches.
HI rob thanks for taking the time for the insight,
Although I knew everything about what you just wrote (didn't know the term ff blending), it's never a bad idea to review.
When I say I'm a noob, I mean everything having to do with gen
All the objects inside gen, except
swiz , vec, mix, >,?/switch
concat
dot
the dot : product of (dot64 ) tells me nothing.
but more the logic inside demonstrates one needs to have a better
underlying understanding of shader building.
---------
Link:
I don't know how that happened.
My mistake
here is the good one
You'll understand what I'm trying to do.
thanks a lot Rob
phiol
What about multiplying the inputs?
Have a look at this:
you are using the red channel of the vignette as the alpha channel of your composition, but doing so, you're translating the "black" pixels into transparent (as alpha values go from 0 to 1, where 0 is transparent and 1 full opacity)
To avoid this, you can either disable the blend_enable attribute in the videoplane, or use the alpha channel of your jit.grab matrix in the composition, and multiply the rgb channels with the r, g, or b channel of your vignette.
my only suggestion is to convert the mask to luminance value, and multiply with your input texture.
Both of you produced 2 patches that gave the exact results I wanted.
Thing is I am still quite a noob @ the way this works (Color mapping)
I see GL as 2 categories:
THE PIXELS & COLOR APPROACH VS 3D OB3D object creation and positioning (transforms)
(textures would be dressing up these shapes.)
How you play with the texture's content, is pixels and colors.
Could almost say to sum up,
there are 2 styles/topics in Jitter and Jitter users:
1. geometry transform manipulation : Jit.gen
2. pixel and color manipulation: jit.gl.pix
-------
(slightly off topic)
Funny observation , (more a hypothesis though),
about the C74 Jitter guys and their interest in these categories
(I obviously could be totally wrong :-)
Andrew Benson is more a pixel/shader guy -playing with colors
Rob is more more of the gl object manipulation in 3d space.
Wes I've seen a bit of both.
Not c74 :
Matmat/silicat more like Rob's style.
Same with pedro’s work I seen.
------
Anyways, back on topic:
I had read up on (even in wikipedia) last spring
what dot and concat was. Took appart patches and tried many combos.
And for these patches I posted yesterday I had even tried implementing those two [dot] & [concat]
but could not work it correctly.
Finally, Helping you help me (if possible)
Color/pixels:
Normal Jitter: order a r g b
Gl: r g b a
luma : has anything to do with black and white and alpha luminance.
alpha: has to do with transparency of your pixels
This combo [vec r g b (r or g or b)] :
Another trick:
- use jit.rgb2luma: to turn an image into black and white
- use [> ]: to then make the colors of image to become say "binary"
you can then flip the colors using the
[!- 1.]
to then play with the colors
jit.gl.slab @file cc.scalebias.jxs
or built it jit.gl.pix
[swiz x] [swiz y] [swiz z]
[* ] [* ] [* ] <
[+ ] [+ ] [+ ] <
[vec 0 0 0 1 ] <
---
Now, [dot] and [concat]:
Hypothesis:
[concat]: is sorta like an [append ].
[dot]: Have no clue what the dot product of ..... ???
THanks so much for any help on this and sorry for the long post,
But as I get better @ this, the more I can help others myself :-)
thanks
phiol
@LSKA Thanks for the patch.
I have a question though:
When I'm putting the r value in the a channel, isn't my red a Value of 1?
Why would my red be a value of 0 ?
thanks a lot
@PHIOL, consider you're working with vectors (the corresponding of planes in a Jitter matrix), so with an array of values. Each pixel has a different value. Basically, what you see as black is value 0, and what you see as white is value 1.
Hence, if put your vignette's r channel in the composition's alpha channel, the corresponding values will set transparency.
Instead, the alpha plane coming from jit.grab has all cell values set at 1.
HTH
Thanks for the response LSKA!
I guess i'm not explaining what I know clearly. Although a long post (3 responses ago), I thought I had done so.
I don't consider myself a noob with Jitter (will post my work when I can) but a noob with jit.gl.pix
As mentioned I did know
Jitter char 0-255 argb
and glcolor float32 0.-1. rgba.
>>Instead, the alpha plane coming from jit.grab has all cell values set at 1.
shouldn't the swiz r be ever moving as such??
Endless thanks for time and knowledge LSKA
shouldn’t the swiz r be ever moving as such??
I didn't understand your question....sorry!
BTW, absolutely I didn't mean to underestimate your jitter knowledge, I was just trying to recall the things I learned not so long ago and put some order in my thoughts as well...
>>I didn’t understand your question….sorry!
you said >>Instead, the alpha plane coming from jit.grab has all cell values set at 1.
-Why would it be 1. as you can see in my last response patch, it's ever moving as expected.
and so the alpha channel should be ever moving from transparent to opaque but it doesn't. why?
- also , could you kindly explain [concat] or [dot] that rob used. I obviously know [dot] is a mathematical function where you multiple and add 2 vectors, but what is it doing in Jitter.
>>BTW, absolutely I didn’t mean to underestimate your jitter knowledge
of course not, I just want to not waste your time and get the good Gen out of you ;-)
-Also , how did you go about learning [dot] and [concat]. Did you already have Glsl knowledge?
Thanks a lot mate
phiol
-Why would it be 1. as you can see in my last response patch, it’s ever moving as expected.
well, that's not the alpha channel, it's the red one. I guess the tricky part is that gen and the pix objects use the RGBA order, even if you're feeding them with ARGB matrices.
As I understand, the matrices' order is rotated when entering the "pix" world.
(look at the following patcher, I added a jit.gl.pix and jit.unpack for comparison)EDIT: Now its' the correct patch, sorry.
About [concat], it works similarly to [jit.pack] in jitter world: in can be used to concatenate vectors, as [vec], but with the possibility to use more vectors per inlet
As for [dot], it is something I'm striving to understand too... Rob's example and the documentation you found helped me make a step forward (so thank you both!)
The rest...for me has just been a lot of trial and error...no previous knowledge, though diving in gen and gl.pix stuff is making me wanting badly to learn GLSL...
Thanks for the patches
>>well, that’s not the alpha channel, it’s the red one.
I know, but if you remember in my original posted patch , I was sending it in the alpha channel and you told my it was giving me 1. when actually it's giving me a changing 1. so it should give me a changing alpha.
Thanks for your response and good luck to us both.
I would of thought that with max7 there would have been jit.gen/jit.pix/jit.gl.pix helpfiles.
like there is for each max object. The documentation that was added in Max7
was all copy/pastes that were all taken from the website. Like Gragory taylor's the joy
of swiz and vectorland. I have already made a large Gen folder w. everything I could find even the BEK workshop that was given. I would kill to have one of those workshop.
-----
Rant:
Bottom line is that I find Jitter to mysterious sometimes and we don't seem to be a lot of Jitter users in the forum.
And so the bottom line is that it's not that popular especially among the companies I've worked with.
They all use either TouchDesigner or Unity. I am trying to change that (maybe I'm just in my head), but I'm trying to make it more popular among other coders here that live across Canada and France. So I did a shit load of little video captures to try to convince them of the possibilities and I do know that gen is really powerful, but being this mystical people don't learn it. It stays hidden. I strongly think that is why C74 made it free. With gen they gave a "large hadron collider" tool but no explination of the fundamentals of how to use it.
Then the other extreme is to revert to making things at a higher level like Maxforlive and Max7's higher level design.
I think there is a Lack of coherency.
All is there though. Just objectively not coherent.
My design for max's 7 UI would of been a color scheme matching the object complexity level.
i.e.
[t b b], [metro] [route] [snapshot~] [gate~] a pale color scheme
[groove~] [seq~ ] [chunker~] [poly~] darker level scheme.
or define some groups
Sorta in the way you see them when you see show CPU usage in the "view" drop down menu.
For a new user, all objects being the same color have the same hierarchical stance.
It's hard for them to isolate the important objects from the parameter controlling ones.
It became even worst in Max7. Even harder to distinguish [message] from [object].
Anyways sorry for the long post.
But I had to say it
phiol
Hi Marie-Hélène,
Thanks for the little hack on LSKA's pix patch, give's it a nice finish.
thanks
phiol
You're welcome
Trying to understand how to create a motionblur effet under a png texture (like a leaf moving over a sky movie file and not blurring the leaf itself .. but only the movement under) and your patch might help me ... interesting patch !
check out the pass.motionblur in the mtr example.
It does just that
ah thanks Phiol
but it blurs the inside. I need to create trails like with erase_color. And trails should be mixed with the a background created by a video layer.
Oh I see. maybe a feedback technique with [jit.gl.slab @file co.additive.jxs]
Yes that could be a way ... thanks ... I'm trying slide as well for gl.pix from the "party light patch"