1#version 300 es 2 3precision mediump int; 4precision mediump float; 5 6in vec4 pos; 7in vec2 oUv0; 8out vec4 fragColour; 9 10uniform sampler2D RT; 11uniform lowp sampler3D chars; 12uniform vec2 numTiles; 13uniform vec2 iNumTiles; 14uniform vec2 iNumTiles2; 15uniform vec4 lum; 16uniform float charBias; 17 18void main() 19{ 20 vec3 local; 21 22 //sample RT 23 local.xy = mod(oUv0, iNumTiles); 24 vec2 middle = oUv0 - local.xy; 25 local.xy = local.xy * numTiles; 26 27 //iNumTiles2 = iNumTiles / 2 28 middle = middle + iNumTiles2; 29 vec4 c = texture(RT, middle); 30 31 //multiply luminance by charbias , beacause not all slices of the ascii 32 //volume texture are used 33 local.z = dot(c , lum)*charBias; 34 35 //fix to brighten the dark pixels with small characters 36 //c *= lerp(2.0,1.0, local.z); 37 38 c *= texture(chars, local); 39 fragColour = c; 40} 41