gaconvn Posted September 6, 2017 Share Posted September 6, 2017 i've got a spritesheet like the link below https://imgur.com/a/aYWAN i want to use this sprite, but i don't know how to make the solid color transparent or i don't know any way to display the sprite with solid color as transparent i've search for days but i can't find any answer. Thanks for your help Link to comment Share on other sites More sharing options...
Garo Posted September 8, 2017 Share Posted September 8, 2017 There are four options for this: 1. To change this spritesheet and replace the black with transparent, open it with Photoshop/Gimp or even something online like https://pixlr.com/editor/ and do it manually. 2. Using a bitmap mask. This way confused me, you're on your own if you want to research it. Here's a Phaser example. 3. Using PIXI's ColorMatrixFilter, you can modify all pixels with a computation matrix. You'll need to include a few extra JS files no longer included in Phaser. Here's sample code of how it works: var whiteFilter = new PIXI.ColorMatrixFilter(); whiteFilter.matrix = [ 1,1,1,1, 1,1,1,1, 1,1,1,1, 0,0,0,1 ]; someSprite.filters = [ whiteFilter ]; 4. Run a function on your spritesheet for each pixel in it and modify the pixel, creating a new asset. Here's a Phaser example. It depends on what you're trying to do. gaconvn 1 Link to comment Share on other sites More sharing options...
Santiago Posted September 11, 2017 Share Posted September 11, 2017 If I understand, you want to change the black background into transparent. In that case I'd use photoshop, is very easy to do it. I'd try first the background remover, setting the tolerance between 15-20% and 20 minutes (even less) of your time, you can clean all that black background. gaconvn 1 Link to comment Share on other sites More sharing options...
Recommended Posts