Forum

Color depth/color approximation shader

Hello vvvv geeks,

What I need to do is controlling the color map used to show a texture.

Best solution: users input a number of colors and the shader makes his best effort to approximate all pixel colors to that color map. So that the final texture is rendered with just the number of colors defined by the user.

User’s input can be a Value or a ColorSpread.

Anybody has a clue or wants to develop this?
My shader/coding skills are too low to make this by myself…

Unfortunately Kalles’s latest CelShader is not sufficien, because it hasn’t such a good control of color depth.

:(

For now I can do it with 2 colors, thanks to the 3rd pixelshader for newbies example :D you can find it in attachment, just load a filetexture.

Thanks a lot!

Xini

sennaLD.rar (1.9 kB)

how’s the budget? ;)

ahah, almost zero, id est the credits if I’ll produce some cool thingy with it :)

i want to apologize here:

the Cel-Shader for now is just a proof-of-concept and the color quantizing feature is just meant as a gimmick…
if i had been 100% confident with it, i already would have had posted it to the user shaders like elemeier already demanded…

:)

hhhm.
i see several barriers here.

*User’s input can be a Value or a ColorSpread.
+
+possible, but FWIK the spreadcount of User’s input must be predefined within the shader.
+if a variable is possible here i would be very thankful for advice.
+
+should somehow look like

#define ColCount 6
float4 UserColColCount: COLOR ;

*and the shader makes his best effort to approximate all pixel colors to that color map.
+
+one would need a more precise definition of how to approximate the unknown count of user’s reference colors.
**RGB difference?
**HSV difference?

assuming that those users’s colors are NOT dispersed evenly it will not be possible to use the same tolerances for all user colors.

Thanks very much Kalle for you help.
You’re making me think a lot.
I will try some other tweaks which do not need a shader, and then come back if I have other problems/questions.
;)

I’ve done a 1d texture map that maight do what you need, I’ll try and dig it out over the next couple of days, I’m a bit out and about at the moment tho…

good, I’ll wait for it ;)
thanks cat

Sorry got caught up in stuff, its in the shader gallery now!
http://vvvv.org/tiki-download_file.php?fileId=1986

Thanks cat, nice shader! Btw I can’t control a lot with it…anyway I’m trying to work with RGB distance, without shader…but for now I think only greyscale is working really fine, need to experiment more with colors. Best would be a 4Bit(Color) node or 4Bit.fx shader ;)