rexrainbow / phaser3-rex-notes

Notes of phaser3 engine

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RexColorReplace: artifacts in changing skin colors

dtturcotte opened this issue · comments

I am trying to change skin tones on a sprite's image using your rexColorReplace: see here

The top of the head, and the face, both have a unified color pixel across their respective regions, but there seems to be discolored "outlines" around the head and face for epsilons 0.1 and 0.25 respectively. How can I remove those artifacts?
Screen Shot 2024-06-19 at 11 50 32 AM

If I change the epsilons higher (0.4, 0.4) the colors are completely off from the ones I want to swap in:

Screen Shot 2024-06-19 at 11 53 36 AM

Desired output (this was manually done in Photoshop):

Screen Shot 2024-06-19 at 1 16 34 PM
commented

How about setting pixelArt: true in game config?

@rexrainbow I have some non-pixel art items in my game, and setting pixelArt: true pixelates the splash images, etc and makes it look terrible.

Any other suggestions? Do you know if Aseprite exports images with semi-transparent pixels? Because, if I open one of the images exported from Aseprite in Photoshop, and use the wand tool to select pixels of a certain region, it won't select all of the pixels in the supposed matching color region.

In Aseprite, if I use the wand tool to select the darker top head region, it selects all matching colors as expected:

Screen Shot 2024-06-20 at 12 50 14 PM

However, if I open the image in Photoshop and select the same region, it appears there are some "semi-transparent" pixels. Perhaps this is throwing off the rexColorReplace?

Screen Shot 2024-06-20 at 12 50 19 PM
commented

From source code of phase engine, you can set a texture to antialias render mode. (Demo, line 15).

this.textures.get('face').setFilter(1)

@rexrainbow This is looking awesome!!!

I use a TexturePacker atlas, so anyway to do something like the following?

this.textures.getFrame(textureKey, framePath).setFilter(1);
commented

It seems texture based (whole image source). so I guess no possible for dedicate frame.