simplified a structure of UIs a bit

This commit is contained in:
minjaesong
2017-07-16 23:15:32 +09:00
parent bf47b82445
commit d6f2f4158c
29 changed files with 321 additions and 371 deletions

View File

@@ -11,7 +11,7 @@ uniform float acount = 1.0;
int bayer[8][8] = {
/*int bayer[8][8] = {
{ 0,32, 8,40, 2,34,10,42}, // 8x8 bayer ordered dithering
{48,16,56,24,50,18,58,26}, // pattern. Each input pixel
{12,44, 4,36,14,46, 6,38}, // is scaled to the 0..63 range
@@ -20,9 +20,25 @@ int bayer[8][8] = {
{51,19,59,27,49,17,57,25},
{15,47, 7,39,13,45, 5,37},
{63,31,55,23,61,29,53,21} }; // fun fact: you can calculate bayer value on-the-fly but LUT is faster
float bayerSize = 8.0;
float bayerDivider = bayerSize * bayerSize;
float bayerSize = 8.0;*/
int bayer[12][12] = {
{0 ,96 ,64 ,8 ,104,72 ,2 ,98 ,66 ,10 ,106,74 }, // 12x12 bayer ordered dithering
{112,80 ,16 ,120,88 ,24 ,114,82 ,18 ,122,90 ,26 }, // pattern. Each input pixel
{48 ,32 ,128,56 ,40 ,136,50 ,34 ,130,58 ,42 ,138}, // is scaled to the 0..143 range
{12 ,108,76 ,4 ,100,68 ,14 ,110,78 ,6 ,102,70 }, // before looking in this table
{124,92 ,28 ,116,84 ,20 ,126,94 ,30 ,118,86 ,22 }, // to determine the action
{60 ,44 ,140,52 ,36 ,132,62 ,46 ,142,54 ,38 ,134},
{3 ,99 ,67 ,11 ,107,75 ,1 ,97 ,65 ,9 ,105,73 },
{115,83 ,19 ,123,91 ,27 ,113,81 ,17 ,121,89 ,25 },
{51 ,35 ,131,59 ,43 ,139,49 ,33 ,129,57 ,41 ,137},
{15 ,111,79 ,7 ,103,71 ,13 ,109,77 ,5 ,101,69 },
{127,95 ,31 ,119,87 ,23 ,125,93 ,29 ,117,85 ,21 },
{63 ,47 ,143,55 ,39 ,135,61 ,45 ,141,53 ,37 ,133}};
float bayerSize = 12.0;
float bayerDivider = bayerSize * bayerSize;
vec4 nearestColour(vec4 incolor) {
vec4 rgbaCounts = vec4(rcount, gcount, bcount, acount);

View File

@@ -5,26 +5,29 @@ uniform sampler2D u_texture;
uniform vec3 topColor;
uniform vec3 bottomColor;
uniform float screenHeight;
// "steps" of R, G and B. Must be integer && equal or greater than 2
uniform float rcount = 256.0; // it even works on 256.0!
uniform float gcount = 256.0;
uniform float bcount = 256.0;
uniform float rcount = 64.0; // it even works on 256.0!
uniform float gcount = 64.0; // using 128: has less banding and most monitors are internally 6-bit
uniform float bcount = 64.0;
int bayer[8][8] = {
{ 0,32, 8,40, 2,34,10,42}, // 8x8 bayer ordered dithering
{48,16,56,24,50,18,58,26}, // pattern. Each input pixel
{12,44, 4,36,14,46, 6,38}, // is scaled to the 0..63 range
{60,28,52,20,62,30,54,22}, // before looking in this table
{ 3,35,11,43, 1,33, 9,41}, // to determine the action
{51,19,59,27,49,17,57,25},
{15,47, 7,39,13,45, 5,37},
{63,31,55,23,61,29,53,21} }; // fun fact: you can calculate bayer value on-the-fly but LUT is faster
float bayerSize = 8.0;
int bayer[12][12] = {
{0 ,96 ,64 ,8 ,104,72 ,2 ,98 ,66 ,10 ,106,74 }, // 12x12 bayer ordered dithering
{112,80 ,16 ,120,88 ,24 ,114,82 ,18 ,122,90 ,26 }, // pattern. Each input pixel
{48 ,32 ,128,56 ,40 ,136,50 ,34 ,130,58 ,42 ,138}, // is scaled to the 0..143 range
{12 ,108,76 ,4 ,100,68 ,14 ,110,78 ,6 ,102,70 }, // before looking in this table
{124,92 ,28 ,116,84 ,20 ,126,94 ,30 ,118,86 ,22 }, // to determine the action
{60 ,44 ,140,52 ,36 ,132,62 ,46 ,142,54 ,38 ,134},
{3 ,99 ,67 ,11 ,107,75 ,1 ,97 ,65 ,9 ,105,73 },
{115,83 ,19 ,123,91 ,27 ,113,81 ,17 ,121,89 ,25 },
{51 ,35 ,131,59 ,43 ,139,49 ,33 ,129,57 ,41 ,137},
{15 ,111,79 ,7 ,103,71 ,13 ,109,77 ,5 ,101,69 },
{127,95 ,31 ,119,87 ,23 ,125,93 ,29 ,117,85 ,21 },
{63 ,47 ,143,55 ,39 ,135,61 ,45 ,141,53 ,37 ,133}}; // fun fact: you can calculate bayer value on-the-fly but LUT is faster
float bayerSize = 12.0;
float bayerDivider = bayerSize * bayerSize;
@@ -45,7 +48,7 @@ vec4 nearestColour(vec4 incolor) {
void main(void) {
float spread = 1.0 / (0.299 * (rcount - 1.0) + 0.587 * (gcount - 1.0) + 0.114 * (bcount - 1.0)); // this spread value is optimised one -- try your own values for various effects!
float scale = v_texCoords.y; // screenHeight;
float scale = v_texCoords.y;
float inR = mix(bottomColor.r, topColor.r, scale);
float inG = mix(bottomColor.g, topColor.g, scale);
float inB = mix(bottomColor.b, topColor.b, scale);