#ifdef GL_ES #extension GL_OES_texture_3D : enable precision mediump int; precision mediump float; precision mediump sampler3D; #endif #define USE_OGRE_FROM_FUTURE #include SAMPLER2D(RT, 0); SAMPLER3D(Chars, 1); OGRE_UNIFORMS( uniform vec2 numTiles; uniform vec2 iNumTiles; uniform vec2 iNumTiles2; uniform vec4 lum; uniform float charBias; ) MAIN_PARAMETERS IN(vec2 oUv0, TEXCOORD0) MAIN_DECLARATION { //sample RT vec2 off = mod(oUv0, iNumTiles); vec2 middle = oUv0 - off + iNumTiles2; vec4 outc = texture2D(RT, middle); //multiply luminance by charbias, because not all slices of the ascii //volume texture are used vec3 local = vec3(off.x * numTiles.x, off.y * numTiles.y, dot(outc, lum) * charBias); //fix to brighten the dark pixels with small characters //outc *= lerp(2.0, 1.0, local.z); outc *= texture3D(Chars, local); gl_FragColor = outc; }