gl shapes overlapping
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?
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. --Copy all of the following text. Then, in Max, select New From Clipboard.----------begin_max5_patcher---------- 1248.3oc6Y1sbapCDG+Z6mBFtpcFGO5C9xmqx44nMSFYipsxfEbDxwNsSe2q PBbrSCXEhLC4zNcpIHDnke5uVs6xOlNweY9AZou2+38EuIS9wzISzMU0vj5y m3ukbXUFoT2MehTJ1w7mYtz2x4RNYKUeo+UvHYMWIemLiJkOUPMOceeu6N4l JYeWeAHZNnt4BAsjxkDIKmeuftRZtwfDrpKdvnfpCf5eN9v361x3pQRacvma zL9m0ZkoqMzGYz8jL1ZdiwVPjq1v3qOcXwglg0bHTOvnSGYVp9gku7gaPg9U s8yoSq9YlknjS2qt4FaPROnGZ+rbR5RBecOXr91tDmeCD6U3RTjgDP8gntwR PevxVZYIYM823BXdnGvCLfRunfpt3gwvKK8P8DjXr9fQeASZAjXWBxathjzI LAEaXBrSlfb3ZtGXx4qyluVvRK2PJnd2ZNHyE6J8tU4qXirxTobxxLpGT0D4 IpnWLTMV2ukHErC9ydqD80WthZmnMxq.iXCEz45UfKkYQdwC41DAIZ0RP7UX sZ.vrKfYOgtWqBW3VHBGeKSwAuAbjzGbb8hxnOwKTjWxpjacDt.dgYAVrFIn vvtVmAC9ihIAVwDr6cm+HKklWjQ3J+4J217zS7emRKjateufIop8BqcmC+f3 NOXQ3IwNzJRQ+Eo1izPfMHE9WjZORA1nR6kHsBcE6Y7z78s616rWz22ajwsd fIYvjio97pRj979rbmT9ruzKjW26KAtPSHfQ3lIk1mZhBcrZ2n.8Pdq1PT5X .n5+ic0rAX3HS7k3EcRLv0hXeKKmHwnOVPCsHxDaXTmPy0NUoGJDd2p+8qp. U1+I3MadpHW9oRdtX6W.2Myy7Wv69rx5lC+7W8GXfh5oJDYH4hjNA5UXi+py 2ITYDSKkd2tJOSwu7TpW1tsjrhMjdxu0Y2W+jGtUxFQIB18JYmVxkpbVkiuD 4fKzDIwvk3txiK.3dM0FBOMi1Grb80J0nABzpjXXWZEL9CQLLw34IvDXbTyL dHnNoUXKgxbbaliyKUK+cuPPnh5UEXqw2B4.srWw3ZJZdqJCrqTFPScIM9fg 06z0BBW3PXI8Vp9GUPJouC5zbz7bb.pvWFU0KhPcQpDGRp+aKUJxUYd31ugB 1UtcMXwTe6ZWKsPk39PEY950O6WsfHTu4RpnNuxpt.Z6smwktJQilIezkSzH 7Op5gAsodXQe7QxIEunCpDY1DxtOzJ7+AJESMdpBdtKsRcgjQgm70VakJmIV z8vOiwe4G1WOLUseNpJy2IV07FW+3l487.kp1Ulw0eukS6D5rNsgklR4m5ZI kUV4sQakfWcRyZ6IzE1yVVZQtx8VYy2vPuucPR7IL0g1bv3hgpzYFU1CJbjo wrRyCGYZ9AzdviK6IZjYOnw17kM54QlK7Ql2vAzbFUVCZbMWgrYmTDdjYOCH erxSXvvYOHKrmngyyyBavy.ZOIiK6wFyYwfZMn2o07h.8gw34gUIVZNnxgp4 rqPX+wVPyjgaeEa7jGMfAsYkqAv3xdFP7.sAOCXXI.armgamWaTywCl0DXCc vCGcvXG3I+E9NQ.iSy35J4BNd1E8cZpBEon3Qpnr1Hz1t+VxC45JgEMSeJia NUWnLeA8QVS+0VkOQrZCSRWo+HwUk75PRU8tTiyOm9Kv.WyaW -----------end_max5_patcher-----------
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.
it was introduced with 6.1.
Thanks a lot:)
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?
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.
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.
[attachment=219807,5361] [attachment=219807,5362] [attachment=219807,5363]
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.
Forums > Jitter