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

Login with username, password and session length

 
Advanced search

1367631 Posts in 64148 Topics- by 56064 Members - Latest Member: Shape

October 13, 2019, 10:59:39 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 267 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


Traversal, exploration, puzzles, and combat in a heroic-fantasy setting
Website ~ Twitter
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