mariogarranz Posted January 28, 2014 Share Posted January 28, 2014 Is there any way to tint the color of a sprite?The only way I've seen I can do this is either having different textures for the same sprite, or overlaying 2 sprites with transparency. First one limits the number of colors, second one sounds like CPU consuming to me.Is there any other option? Thanks jpdev 1 Link to comment Share on other sites More sharing options...
jpdev Posted January 28, 2014 Share Posted January 28, 2014 I would like to know this too, there is surely a way to manipulate a sprite after it has been loaded from a png file. Link to comment Share on other sites More sharing options...
mariogarranz Posted January 28, 2014 Author Share Posted January 28, 2014 After some search on the forums I found this answer from past October: http://www.html5gamedevs.com/topic/1897-i-want-to-highlight-my-sprites-could-you-point-me-in-the-right-direction/?hl=tint#entry12982 I haven't found any news about Pixi supporting shaders, so I guess its still not built in Phaser. Link to comment Share on other sites More sharing options...
Zeterain Posted January 28, 2014 Share Posted January 28, 2014 I know Pixi 1.4 supports tinting, but right now phaser is using Pixi 1.3. Pixi 1.4 integration is on the roadmap for Phaser 1.2 I believe. Link to comment Share on other sites More sharing options...
rich Posted January 28, 2014 Share Posted January 28, 2014 Yes this is now built into Pixi, so will come to Phaser soon. Although it's still bloody expensive, so use it carefully. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted February 15, 2014 Share Posted February 15, 2014 I'm very interested in this as well I have an habit of making grey spritesheet and tinting them in the chosen color, in order to be able to have variety without increasing the textures ammount. This seems to be the most basic feature to me ( as in Flixel, Unity ...etc... ) so I'm a little surprised not to find it in Phaser/Pixi (I'm not making any critic here, just wanting to understand ) Is this so much time-consuming?Is it not just a shader multiplying each pixel color by another color? Thanks for your time. Mefteg 1 Link to comment Share on other sites More sharing options...
rich Posted February 15, 2014 Share Posted February 15, 2014 It's in 1.2 (because Pixi added support for it). Note that you create an extra canvas object for every single texture you tint, so use it sparingly. On WebGL it's all done in a shader, but not on canvas. Link to comment Share on other sites More sharing options...
cvshepherd Posted August 27, 2014 Share Posted August 27, 2014 It's in 1.2 (because Pixi added support for it). Note that you create an extra canvas object for every single texture you tint, so use it sparingly. On WebGL it's all done in a shader, but not on canvas. Is this still the case? The canvas profiler in chrome shows me only one canvas, even with tinted sprites in the game, or wouldn't this show up in the profiler? Link to comment Share on other sites More sharing options...
rich Posted August 27, 2014 Share Posted August 27, 2014 Yes it's the case, but the tint cache is re-used. I believe it will create one canvas per 8 colour steps. Link to comment Share on other sites More sharing options...
Recommended Posts