Hebbe Posted June 21, 2017 Share Posted June 21, 2017 Hi! I'm using pixi 4.5.3 and can't find a way to clear out an rectangle from my transparent render texture. Seems that all blend modes have gl.ONE_MINUS_SRC_ALPHA in them Is there any hack around this? I have a large renderTexture with mostly static bitmap text and I want to update only parts that have changed for better performance. Is there any other way to update only part of an rendertexture while retaining transparency? Thanks! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 21, 2017 Share Posted June 21, 2017 There's a branch for that case, make your own blendMode: https://github.com/pixijs/pixi.js/pull/4049 , the build is here: https://pixijs.download/dev-blendmodes-class/pixi.js var gl = app.renderer.gl; //the context var mySuperBlendMode = new PIXI.BlendMode(gl.ONE, gl.ONE); //its actually kinda ADD ;) sprite.blendMode = mySuperBlendMode; Unfortunately its too heavy change for pixi-v4 , so it will be introduced in v5. For now you can just use the branch, its up-to-date UPD. Do remember that both canvas and texture are premultiplied by default, that means (R*a, G*a, B*a, a) are stored instead (R,G,B,a). All coefficients are applied to those numbers. Quote Link to comment Share on other sites More sharing options...
dmko Posted June 22, 2017 Share Posted June 22, 2017 I forgot to followup on your erase mode update... thanks for doing that btw! Is this the same answer? (will be native in v5 only) Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 22, 2017 Share Posted June 22, 2017 Yes, answer is the same, but now there are a number of people who use that feature. And I updated the branch before I answered this one post. dmko 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.