johnnycash

Members
  • Content Count

    5
  • Joined

  • Last visited

Everything posted by johnnycash

  1. I want to generate multiple textures from one base texture. The multiple textures would have different color of a specific attribute (skin, shirt, pants, hair..). I looked at one example (https://www.goodboydigital.com/pixijs/bunnymark/), but the bunnies it uses are extracted from the image and not dynamically generated with Pixi... So, how do I generate multiple textures with different color specific attributes with Pixi? Example code would be greatly appreciated.
  2. johnnycash

    How to generate different color textures with Pixi?

    Optimized function (removed new before PIXI.RenderTexture.create) : function multiColorReplaceSpriteCopy(renderer, sprite, replacements, epsilon) { let container = new PIXI.Container(); let filter = new PIXI.filters.MultiColorReplaceFilter(replacements, epsilon); container.addChild(sprite); container.filters = [filter]; let rt = PIXI.RenderTexture.create(sprite.width, sprite.height, PIXI.SCALE_MODES.LINEAR, 1); var sprite_copy = new PIXI.Sprite(rt); renderer.render(container, rt); return sprite_copy; }
  3. johnnycash

    How to generate different color textures with Pixi?

    Success! I've written a function for my use case. function multiColorReplaceSpriteCopy(renderer, sprite, replacements, epsilon) { let container = new PIXI.Container(); let filter = new PIXI.filters.MultiColorReplaceFilter(replacements, epsilon); container.addChild(sprite); container.filters = [filter]; let brt = new PIXI.BaseRenderTexture(sprite.width, sprite.height, PIXI.SCALE_MODES.LINEAR, 1); let rt = new PIXI.RenderTexture(brt); var sprite_copy = new PIXI.Sprite(rt); renderer.render(container, rt); return sprite_copy; } And here's the final result: https://jsfiddle.net/msovjknx/7/ @ivan.popelyshev would appreciate Your input 👍
  4. johnnycash

    How to generate different color textures with Pixi?

    I've made some progress: https://jsfiddle.net/5zxgctnm/5/ I used MultiColorReplaceFilter and added it to container.filters. However, I haven't found a way to apply a filter to a RenderTexture.
  5. johnnycash

    PixiJS: SpriteSheet Tutorial

    What if I want to have multiple different color characters? How can I change the color of the character in this case with PIXI?