Overlapping GL objects and alpha channel

    Dec 05 2011 | 3:27 am
    I'm sure this is just something simple that I'm overlooking but I haven't been able to get this to work.
    Sample patcher below has two overlapping jit.gl.videoplanes with textures that have alpha channels (supplied by jit.expr). Shouldn't I be able to see the background object (@layer 3) wherever the foreground object (@layer 2) is transparent, rather than the erase color?
    Thanks, James

    • Dec 05 2011 | 3:38 am
      The lowest numbered layers draw first, so @layer 2 will come before @layer 3. When @layer2 draws, it will blend with the erase_color. When @layer 3 draws, it will blend with @layer 2 and the erase_color. FWIW, the texture loading issue to mention in the patch doesn't exist in Max6.
    • Dec 05 2011 | 3:45 am
      Thanks for the quick reply. If I switch the layer numbers, I can't see the small square at all.
    • Dec 05 2011 | 3:53 am
      You'll need to set @depth_enable 0 for the videoplanes so that they don't block each other.
    • Dec 05 2011 | 4:08 am
      Thanks - adding @depth_enable 1 to both videoplanes does not change anything: I still only see the big rectangle with texture1.
      I am on Max 5.1.9 (47862).
    • Dec 05 2011 | 4:09 am
      (I guess I shouldn't be surprised - depth_enable is enabled by default.)
    • Dec 05 2011 | 4:11 am
      Interestingly, if I set the position of the texture2 videoplane to 0. 0. 0.001, it does appear correctly.
      I thought this might be front-face culling, but that also seems to be off by default.
    • Dec 05 2011 | 4:13 am
      Ah ha! Setting @depth_clear 1 on them does the trick, even when the position is not set. Sweet!
    • Dec 07 2011 | 10:26 pm
      Maybe you missed this, but Wes said depth_enable 0, not 1. Otherwise you have z-fighting issues (you can google that term).
    • Dec 10 2011 | 6:39 am
      I did miss that! depth_clear 1 was working fine on the jit.videoplanes, but after applying this to some more complex geometries that use jit.gl.mesh I was still seeing "z-fighting" amongst quads within one mesh. depth_enable 0 clears that up.
      Thanks a lot!