alpha and gl

Oct 29, 2012 at 2:17pm

alpha and gl

Hello, I want to make a simple animation in jitter, and I have two questions about alpha in GL.

1. In my patch I have a plane and ball under it. When I set alpha value of the plane to 0 it looks like the plane gets the background color and I can not see the ball throw the plane. Can anyone tell me how to fix that and why does this happen.

2. How can I make a shape alpha on the plane like in a picture for example.

please help me

[attachment=207142,4600]

Attachments:
  1. OneF.maxpat
#64982
Oct 29, 2012 at 3:55pm

Think the problem was with the way you had the trigger for the renderer set up. If you are triggering one gl shape explicitly while the other draws automatically you could run into layering issues.

This should help. To get a texture on a mesh you need to send it a texture array (example I pulled off the forum).

– Pasted Max Patch, click to expand. –
#234321
Oct 30, 2012 at 7:54am

thanks a lot!!!! :)

#234322
Oct 30, 2012 at 10:45am

:( ok, I looked at the gl.mesh refpages.. second inlet is for vertex, but I couldn't understand how this part works.
Can you explain please.

[attachment=207256,4603]

Attachments:
  1. ScreenShot20121030at12.04.27PM.png
#234323
Oct 30, 2012 at 3:28pm

Okay this part is where i kind of fall on my face. I don’t know how the vertex coordinate system works precisely but you can see what’s happening in the following patch.

Each cell has 2 planes and it’s dim is 20 20 so I’m assuming that the vertex coordinates are as follows:
Plane 0, cell 0 19 val 0
Plane 1 cell 0 19 val 0
Plane 0 cell 0 0 val 0
Plane 1 cell 0 0 val 1
Plane 0, cell 19 0 val 1
Plane 1 cell 19 0 val 0
Plane 0 cell 19 19 val 1
Plane 1 cell 19 19 val 1

Meaning from the bottom left clockwise you’ll see (0,0;0,1;1,0;1,1) which are normalized corrdinates (but different than the standard jitter matrix which is usually represented as top-left, top-right, bottom-left, bottom-right.

So jit.matrix sets up a matrix with 2 planes, each cell represents an X, Y coordinate of dimensions 20 x 20. Jit.expr normalizes values across X on plane 0 (which represents the X in each cell) using (norm[0]) and then normalizes and subtracts the value from 1. down the Y plane on plane 1 (which represents the Y in each cell) using (1. -norm[1]).

But this is my educated guess based on what I’m seeing… I could be mistaken.

– Pasted Max Patch, click to expand. –
#234324
Oct 31, 2012 at 4:11pm

Thanks, you save me!

#234325

You must be logged in to reply to this topic.