Mgraphics to texture with transparency


    Aug 31 2018 | 5:35 pm
    Hey folks,
    I am doing some experiments with drawing mgraphics sketches to a texture. I would like to display these on a texture transparently on a background, but I can not seem to set the transparency of the texture. Setting the blendcolor on the texture does not seem to set anything. Is there something I am missing? Some alpha channel setting I am not seeing?

    • Aug 31 2018 | 6:09 pm
      [mgraphics] itself works fine with transparency (and textures). Simple example here:
    • Sep 01 2018 | 2:53 am
      Your example does not seem to demonstrate any transparency. Is there something I am supposed to set?
    • Sep 01 2018 | 6:24 am
      You can't see the transparency. It's transparent.
      Previous example uses [mgraphics] to create image with transparent background and white rect on the center.
      And here another example - I've added second rectangle. This one is semitransparent.
    • Sep 02 2018 | 2:23 am
      Ahhh okay, I see it now. Thanks I will study this.
    • Sep 02 2018 | 10:23 am
      Anthony
      I think, most important elements are on gl side, not in mgraphics (however clear_surface message is very useful). So, setting @blend_enable and @blend attributes is a key to success.
    • Sep 02 2018 | 5:22 pm
      Yes I agree, ideally I would like to set this on the texture and have it rendered as transparent. I see there is a blend_enable and blend_mode on the gridshape I am using. I have updated my patch, please refer to previous .js file. I am using the default blend_mode, but still do not seem to be getting any transparency.
      Actually I realize now that there are two things I am asking here. 1. How do you make the whole source image transparent? 2. How do you make a select color transparent? (In this case black)
    • Sep 02 2018 | 6:28 pm
      Anthony
      I messed with your project a bit (and I removed some parts, but should be rather easy to rebuild it), so you have to clear things by yourself, but I think this is the solution.
      clear_surface(); (inside your script) and all the attributes related to depth and blend (inside the patch) are most important.
    • Sep 03 2018 | 3:14 am
      Awesome, that's it! I see you used a videoplane in the end, I tested it with a gridshape plane and it works as well.
      Thanks!