Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411281 Posts in 69324 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 08:33:46 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Color Reindexing Shader Help
Pages: [1]
Print
Author Topic: Color Reindexing Shader Help  (Read 1634 times)
NoodleSushi
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
Thaumaturge
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.
Logged

miki
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?
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic