Trouble with transparency

    Oct 04 2009 | 7:05 pm
    Hello all,
    I'm not new to Max but quite new to Jitter, and this current problem has me going batty.
    The attached patch attempts to load a map in layer 2 and overlay a set of icons in layer 1 of, loading the images via a set of objects.
    The trouble arises when I try to combine the icons, which are .png and contain transparency, into layer 1 of As they have to be scaled to proper size using dstrect into, the transparency is only applied to the specified area; the rest of jit.pwindow remains black.
    Since I will be using a good number of icons, the [jit.op +] method may not be optimal either.
    Does anyone know how to ensure layer 1 remains transparent wherever the dstrect does not apply?
    Many many thanks,

    • Oct 13 2009 | 6:22 am
      There are a number of ways to do it depending on the final effect you want. In your current patch, you could set @blend_mode 6 1 for additive blending. Anything black will seem to be transparent.
    • Oct 15 2009 | 7:19 pm
      Thanks for the tip, however the blend_mode you propose yields semi transparent icons. Also, possibly due to the jit.op setup, the 'frontmost' icon's position ends up defining the only visible space for the other icons - they disappear when they are moved outside of that zone.
      Still stumped...
      Here's an updated patch with ability to change blend_mode, and a sample icon attached to see things in context...
    • Oct 15 2009 | 7:49 pm
      if the dstrect attributes of the qt.movies are set *after* the icon image is read in and banged out once, then the patch works as expected.
      if you need a more flexible solution, you might want to do your image scaling/positioning with gl.videoplanes or gl.meshes
    • Oct 15 2009 | 10:01 pm
      Hello, Here is a patch that uses OpenGL for the alpha blending. This is a more robust and efficient way to do what you are doing, and actually respects the image transparency.
      Andrew B.
    • Oct 16 2009 | 7:24 pm
      Thank you Andrew and Rob, both good points and solutions. But if I have, say, 10 icons to place on the map, is there no more efficient solution than to create a gl.videoplane layer for each and every one? Is there a kind of video equivalent to poly~?
      Also, I'm noticing that when the icon is scaled to around 0.1, it gets grainy. Is this an interpolation issue, or am I hitting some sort of limit on screen resolution?
    • Oct 17 2009 | 6:06 pm
      a few different options available to solve this problem.
      first off, yes there is a poly~ object for video. it's called poly~. you can encapsulate anything you wish in a poly~ object. search the jitter forum for several different examples.
      second, if you are using the same image texture, you don't necessarily have to use a separate videoplane for each icon. you can simply tell the videoplane to redraw itself in several different positions, each draw call. check out andrew's Dancing Sprites recipe 06:
      last, gl.mesh might be the most efficient way to go, but also a bit trickier to learn. once again andrew illuminates. check out recipe 36 and 37: