No.
I already know that.....
But I don't want to get the brightness value of the pixel A.
I want to have another pixel B that have the same brightness as A.
-----------------------------------------
I have seen the codes of Ycocg from nvidia's site.
The code is simple, but no artist tools for convert dds file from rgb to ycocg.
It works by removing the intensity from the color texture and replacing it with the intensity texture. hueAndSat is the projection of the color onto the intensity=0 plane.
First try to palette textures using texture lookup
I think it's easier than color space tricks.
//======================================
uniform sampler2D idx; // image in gray color as index
uniform sampler2D pal; // 256X4 Map as palletize map.
// It's a grad map , white to black,
// then colorize it in photoshop
varying vec2 UV;
void main(void)
{
float index = texture2D(idx, UV).y; //get index , a float between 0.0~1.0
vec2 newUV = vec2(1.0-index , 0.0); //use index as UV.x
newUV.x = clamp(newUV.x , 0.1 , 0.9);
vec4 color = texture2D(pal,newUV); //get palletize color
gl_FragColor = vec4(color.xyz, index.w); //done
}
//======================================