Mgraphics to texture with transparency
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?
[mgraphics] itself works fine with transparency (and textures). Simple example here:
Your example does not seem to demonstrate any transparency. Is there something I am supposed to set?
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.
Ahhh okay, I see it now. Thanks I will study this.
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.
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)
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.
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!