gl shapes overlapping

Mar 7, 2013 at 8:41am

gl shapes overlapping

Hello,
I am making a simple patch with multiple gl shapes in array, and I have this problem with overlapping. When I put shapes one over another in write order there are no problem, but when I put for example the first shape in front of the second I am losing its transparency.
Can anyone help?

[attachment=216877,5121]

Attachments:
  1. ScreenShot20130305at2.26.36PM.png
#66930
Mar 7, 2013 at 8:24pm

it’s not entirely clear from your patch what you’re trying to achieve, but my assumption is some kind of particle effect.

you should check out the brand new @depth_write attribute for jit.gl.* objects.
this allows you to have both transparency and depth_enable on certain objects.

the trick is to draw all opaque objets first (@layer 0) and all transparent objects last (@layer 1)

you may also want to checkout @view_align 1

here’s a patch:

– Pasted Max Patch, click to expand. –
#240904
Mar 8, 2013 at 10:45am

Thanks for your replay,
my mistake! @depth_enable this is the answer of my question. Anyway your advices are very helpful for me. One more about @depth_write I am not sure that I have this attribute, in which version of max is it included? I am with 6.0.8.

#240905
Mar 8, 2013 at 6:27pm

it was introduced with 6.1.

#240906
Mar 8, 2013 at 7:15pm

Thanks a lot:)

#240907
Mar 29, 2013 at 11:33pm

Hello, can I ask one more question about ordering shapes, sorry but I am really lost in it:(

So, what I have to do if I have one videoplane object, with multiple shapes in it? How can I order it in between other shapes?
I don't know why it stays or on the top of everything or on the bottom?
Or is there other way to have 60 shapes except 60 videoplane objects?

[attachment=219433,5329]

Attachments:
  1. ScreenShot20130330at1.18.14AM.png
#240908
Mar 31, 2013 at 7:36pm

sorry, it’s not clear from your patch what you are asking.
i suggest you simplify your patch, give some steps to reproduce, and explain clearly what is not working.

#240909
Apr 2, 2013 at 6:56pm

Sorry I will try again.

In the patch that you send me with separate videoplane objects everything is perfect! Shapes haves transparency one to another and to the torus.
1. is when I do not use the matrix, but only videoplane like a single object, everything looks nice, like in your patch.
2. when I try to use the matrix (connect metronome to it), shape goes on the back of the torus.
3. when I push depth_write to one shape comes in front of the torus, but with out transparency to it.
Looks like, if I give to the video plane object a matrix for input instead of position message, it goes on the back of other shapes.

Sorry if my question is naive, I am new in this, and I don't clearly understand why it happens, if it is on the 1 layer.
My question is how can I order this video plane, when I want to put it in front of others, as when it was before I used a matrix for it's input?

I hope that it's more clear now.

Thank's

[attachment=219807,5361] [attachment=219807,5362] [attachment=219807,5363]

Attachments:
  1. 3.png
#240910
Apr 27, 2013 at 7:08am

OK I have found some information about OpenGL. The only way I found is discarding pixels with shader instead of alpha, but I could not have a gradient this way.

#240911

You must be logged in to reply to this topic.