Julio Rodrigues Posted March 24, 2014 Share Posted March 24, 2014 Hello, How can I increase the brightness in realtime of a sprite? Quote Link to comment Share on other sites More sharing options...
xnamex Posted March 25, 2014 Share Posted March 25, 2014 Hi, You could either use the tint property or manipulate the texture object at pixels level. Quote Link to comment Share on other sites More sharing options...
Julio Rodrigues Posted March 27, 2014 Author Share Posted March 27, 2014 Hey, I'm not being able to do it using the tint property. Can you give me an example? Quote Link to comment Share on other sites More sharing options...
xnamex Posted March 29, 2014 Share Posted March 29, 2014 Well, I have no context here, about where you're gonna use this, but I'm assuming this won't be fast, and could not be used in an update loop, as in applying continuously the brightness. So first one, tintspriteInstance.tint = 0xFF0000; // tint the sprite with REDSecond, you could use this method here: http://www.html5gamedevs.com/topic/4139-get-access-to-pixel-color-from-a-texture/Note: Keep in mind this is actually generating a new texture, which in webGL means uploading it back to the engine. This could take a while, depending on the texture size, environment, etc. Cheers! Quote Link to comment Share on other sites More sharing options...
Julio Rodrigues Posted March 29, 2014 Author Share Posted March 29, 2014 Thank you for your reply xnamex, but Unfortunately, the tint method is not working, It only darkens it.And webgl doesn't work on my target devices Quote Link to comment Share on other sites More sharing options...
hot_tea Posted June 28, 2020 Share Posted June 28, 2020 function brightnessFilter(b){ // -1~1 let filter = new PIXI.filters.ColorMatrixFilter(); if(b >0){ filter.matrix = [ 1-b, 0, 0, 0, b, 0, 1-b, 0, 0, b, 0, 0, 1-b, 0, b, 0, 0, 0, 1, 0]; }else{ filter.matrix = [ 1, 0, 0, 0, b, 0, 1, 0, 0, b, 0, 0, 1, 0, b, 0, 0, 0, 1, 0]; } return filter; } 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.