You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I have been using quite some pixi-filters I thought it would be fun and interesting to develop my own for the sake of practicing creating fragment shaders.
I have created a posterization filter which limits the amount of colors to a chosen palette (either own supplied or from a preset) or if no palette is chosen; limits the original colors. It works by mapping the current pixel color to the closest matching color in the palette.
Note: I have tried various different ways to find the best matching color, including converting from sRGB to XYZ to LAB for the comparison. However, I got the best results doing a simple euclidean distance comparison in the sRGB space and this also seems to be what Adobe Illustrator is using for its' posterization effect (I have compared results with my shader and the results are identical). Hence I think the approach is good.
Some examples and with presets I've created:
Original:
No palette supplied (reduced original colors):
NES:
Gameboy:
Night:
Patagonia:
Solarized:
Autumn:
Blue:
Accent:
And you can supply any palette of your own with any amount of colors, if you don't choose any of the presets above. Endless options and opportunities.
Now to the main question; would you be interested in having this as a filter? If so I'll simply do a PR of it and be more than happy to share it :)
The text was updated successfully, but these errors were encountered:
@ivanpopelyshev Do you mean I should have a look at the one you supplied for inspiration how to implement it as a filter, or do you mean my posterization filter is too similar? 🤔
I'll do a PR and gladly accept a code review and suggestions how do improve the implementation.
As I have been using quite some pixi-filters I thought it would be fun and interesting to develop my own for the sake of practicing creating fragment shaders.
I have created a posterization filter which limits the amount of colors to a chosen palette (either own supplied or from a preset) or if no palette is chosen; limits the original colors. It works by mapping the current pixel color to the closest matching color in the palette.
Note: I have tried various different ways to find the best matching color, including converting from sRGB to XYZ to LAB for the comparison. However, I got the best results doing a simple euclidean distance comparison in the sRGB space and this also seems to be what Adobe Illustrator is using for its' posterization effect (I have compared results with my shader and the results are identical). Hence I think the approach is good.
Some examples and with presets I've created:
Original:
No palette supplied (reduced original colors):
NES:
Gameboy:
Night:
Patagonia:
Solarized:
Autumn:
Blue:
Accent:
And you can supply any palette of your own with any amount of colors, if you don't choose any of the presets above. Endless options and opportunities.
Now to the main question; would you be interested in having this as a filter? If so I'll simply do a PR of it and be more than happy to share it :)
The text was updated successfully, but these errors were encountered: