Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

Advanced search

1373422 Posts in 64863 Topics- by 57054 Members - Latest Member: philosec

February 27, 2020, 04:04:27 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Color Reindexing Shader Help
Pages: [1]
Author Topic: Color Reindexing Shader Help  (Read 312 times)
Level 0

View Profile
« on: June 22, 2019, 10:01:16 PM »

I'm currently programming a shader that will replicate the dithering and color-limited flipnote effect.

Problem is that whenever I change the color palette order, colors that get checked late dominate each other  Concerned

My shader scans the original color and palette color then checks the Euclidean distance (vec3) of each 2 colors.
Unfortunately there are also some colors that have close or matching distances, which makes the last ones dominate.
What should I do to distribute equally and match the correct colors?
Is there another algorithm that determines which is the closest color? (Not Euclidean distance) Beg

(Thank you in advance for replying btw)
« Last Edit: June 23, 2019, 02:56:19 AM by NoodleSushi » Logged
Level 10

View Profile WWW
« Reply #1 on: June 24, 2019, 11:16:01 AM »

Hmm... This is off the top of my head, so I don't know whether it will work, but perhaps it might help to weight the contribution of each channel to the final distance, with the most-extreme channels having higher weights.

Traversal, exploration, puzzles, and combat in a heroic-fantasy setting
Website ~ Twitter
Level 0

View Profile
« Reply #2 on: June 24, 2019, 11:59:22 PM »

you can use CIEDE2000 or something similar to get the VISUAL distance between colors: https://github.com/topics/ciede2000

If the order of processing is an issue then I can only guess that maybe you are writing processed(replaced) pixels back into the image that is being processed and these pixels get processed a second time?
Pages: [1]
Jump to:  

Theme orange-lt created by panic