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.
42 lines
1.2 KiB
42 lines
1.2 KiB
|
|
#iChannel0 "file://./Textures/colorful.jpg"
|
|
#iChannel0::WrapMode "Mirror"
|
|
|
|
|
|
#iChannel1 "file://./Textures/palette_LUT_opt.png"
|
|
#iChannel1::MinFilter "Nearest"
|
|
#iChannel1::MagFilter "Nearest"
|
|
#iChannel1::WrapMode "Mirror"
|
|
|
|
mat4 bayerIndex = mat4(
|
|
vec4(00.0/16.0, 12.0/16.0, 03.0/16.0, 15.0/16.0),
|
|
vec4(08.0/16.0, 04.0/16.0, 11.0/16.0, 07.0/16.0),
|
|
vec4(02.0/16.0, 14.0/16.0, 01.0/16.0, 13.0/16.0),
|
|
vec4(10.0/16.0, 06.0/16.0, 09.0/16.0, 05.0/16.0));
|
|
|
|
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;
|
|
|
|
float bayerVal = bayerIndex[int(fragCoord.x) % 4][int(fragCoord.y) % 4];
|
|
texCol.r = step(bayerVal, texCol.r);
|
|
texCol.g = step(bayerVal, texCol.g);
|
|
texCol.b = step(bayerVal, texCol.b);
|
|
|
|
texCol = pow(texCol, vec3(2.2));
|
|
|
|
vec2 coords;
|
|
coords.x = texCol.r;
|
|
coords.y = (texCol.g*63.+floor(texCol.b*63.)*64.)/(4095.);
|
|
vec3 tmp = texture(iChannel1, coords).rgb;
|
|
|
|
col.rgb = tmp;
|
|
fragColor = col;
|
|
}
|
|
|