a quick question on luminance and the jit.gl.pix dot object
Hi all
I have a quick one about dot products and luminance.
being use to control vertices with gen, Controlling pixels is and glsl shaders is a different game.
I was reading on Andrew's terrific articles on Building your 1st shader and the section about dot product caught my attention.
then I searched about dot products in shader contexts and how they're used to do a quick version of the luminance equation.
(R*0.299 + G*0.587 + B*0.114)
I also had seen this in the past in the jit.rbg2luma. converting a 4 plane to single plane matrice.
the same equation can be done with jit.gl.pix but the output contains 4 planes.
Anyways, I put together a little jit.gl.pix patch to take advantage of the [dot] object and create a luminance control
on the RGB color.
I have a few very simple questions in the patch.
Any pointers would be greatly appreciated.
Thanks a lot
phiol
little bump
anyone can confirm this :-)
thanks
I'm a little confused by the default values for your "luma" param. If you are doing a luminance conversion, following the equation you list in the patch, the luma values should be 0.299 0.587 0.114 0. (The trailing zero is to give the alpha channel a zero weight in the equation). I always assumed that the output of the dot operator in gen was a single value (not vec4), as it works in GLSL.
Hi Andrew thanks a lot for responding,
>>I’m a little confused by the default values for your "luma" param. If you are doing a luminance conversion, following the equation you list in the patch, the luma values should be 0.299 0.587 0.114 0.
Why I chose those default values. It's to get rid of the blue area of the oh.mov video.
>>I always assumed that the output of the dot operator in gen was a single value (not vec4), as it works in GLSL.
:-/!!
I'm a little confused that you are a little confuse
This was the point of my post , I was confused that it gave me a 4 plane,
but things are such gen right?, if 4 go in , 4 must come out.
that's why the 2nd question in my patch was is dot the equivalent to jit.rgb2luma
and the 3rd question is the [swiz r ] necessary
but even with a single jit.gl.pix with a single [dot]
Have a look.
And thanks again for answering
if you disable blend_enable the two images look the same. jit.rgb2luma spits out a 1 plane matrix, and jit.gl.pix spits out a 4 plane matrix, with each plane containing identical luminance values. the internal texture of jit.gl.videoplane handles these two cases slightly differently.
if you want identical output, you must set the alpha plane to 1 in your gen patch, like so:
Thanks a lot Rob,
I was wanting to get a 1 plane output cause I something use the jit.rgb2luma to create a depth z plane control with stuff kinect etc...
So I guess in that particular setup I 'll have to stick with jit.rgb2luma.
As for my 2nd question : is dot the equivalent to jit.rgb2luma
and the 3rd question is the [swiz r ] necessary
I guess the answer is yes and no. Equivalent if you setup the equation and NO if you set it up differently
and my 3rd question: I guess I don't know if [swiz r ] is needed?
thanks again guys
phiol