superimposing two gl objects with alpha channel transparency
In the attached patcher, I've got two jit.gl.nurbs that I'm animating. Each one has a texture with an alpha channel. The alpha channel determines which parts of the object are visible.
Since the objects are at about the same depth, each one should 'cut through' the other one when it's closer, which is pretty much what happens – except for one problem.
The yellow nurbs (which has a lower @layer number) appears as it should. But the cyan nurbs (with a higher @layer) disappears whenever any part of the cyan nurbs comes closer, even the transparent parts. If you give the yellow nurbs a higher layer, the problem reverses.
If it's hard to parse what's going on, stop the animation & change the z position of either object. One of them does what it's supposed to, but the other one disappears when it goes behind the transparent parts of the first object.
It seems to me that this should be possible, but I've tried everything (@blend_mode, @depth_enable, @layer, etc) that I can think of.
Hi,
Since the nurbs intersect each other multiple times, it's not possible to define a rendering order that reflects into correct transparency.
A way to make it work is to depth-sort the shapes per pixel:
Hope it helps,
cheers!