You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shaders/2D/indexed/indexed.glsl

34 lines
976 B

#iChannel0 "file://./Textures/colorful.jpg"
#iChannel0::WrapMode "Mirror"
#iChannel1 "file://./Textures/palette_LUT_opt.png"
#iChannel1::MinFilter "Nearest"
#iChannel1::MagFilter "Nearest"
#iChannel1::WrapMode "Mirror"
#define S(a,b,c) smoothstep(a,b,c)
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
void mainImage ( out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord/iResolution.y);
vec4 col = vec4(0,0,0,1.0);
vec3 texCol = texture(iChannel0, uv).rgb;
vec2 coords;
coords.x = texCol.r;
//float g = floor(map(texCol.g, 0., 1., 0., 63.));
//float b = floor(map(texCol.b, 0., 1., 0., 63.));
//coords.y = map(g+b*64., 0., 4095., 0., 1.);
coords.y = (texCol.g*63.+floor(texCol.b*63.)*64.)/(4095.);
vec3 tmp = texture(iChannel1, coords).rgb;
col.rgb = tmp;
fragColor = col;
}