First the images that you want to use are converted to images with the r value as the index and g and b as 0.
These palettes are images that contain a single pixel of the color to use. Example: (0,0) would be color one with color #FAFAFA, (1,0) would be color 2, and so on and so on.
This is the shader code.
Code: Select all
[[
extern Image palette;
extern vec2 palette_dimensions;
vec4 effect(vec4 color,Image img,vec2 img_pos,vec2 screen_pos) {
vec4 cpixel=Texel(img,img_pos);
vec2 upos=vec2(cpixel.r/palette_dimensions.r,0);
return Texel(palette,upos)*color;
}
]]