Demo entry 6729217

shader

   

Submitted by anonymous on Apr 02, 2018 at 09:38
Language: GLSL. Code size: 1.8 kB.

varying highp vec2 textureCoordinate; 
uniform sampler2D inputImageTexture; 
uniform sampler2D lookUpGray; 
uniform sampler2D lookUp; 
uniform sampler2D lookUpOrigin; 
uniform highp float levelRangeInv; 
uniform lowp float levelBlack; 
uniform lowp float alpha; 
lowp vec3 texel; 
lowp vec3 color; 
lowp vec3 colorOrigin; 
mediump float blueColor; 
mediump vec2 quad1; 
mediump vec2 quad2; 
mediump vec2 texPos1; 
mediump vec2 texPos2; 
lowp vec4 newColor1; 
lowp vec4 newColor2; 
lowp vec4 newColor1Origin; 
lowp vec4 newColor2Origin; 
void main() 
{ 
    colorOrigin=texture2D(inputImageTexture, textureCoordinate).rgb; 
    color = clamp((colorOrigin - vec3(levelBlack, levelBlack, levelBlack)) * levelRangeInv, 0.0, 1.0); 
    texel.r = texture2D(lookUpGray, vec2(color.r, 0.5)).r; 
    texel.g = texture2D(lookUpGray, vec2(color.g, 0.5)).g; 
    texel.b = texture2D(lookUpGray, vec2(color.b, 0.5)).b; 
    texel = mix(color, texel, 0.5); 
    texel = mix(colorOrigin, texel, alpha); 
    blueColor = texel.b * 15.0; 
    quad1.y = floor(floor(blueColor) * 0.25); 
    quad1.x = floor(blueColor) - (quad1.y * 4.0); 
    quad2.y = floor(ceil(blueColor) * 0.25); 
    quad2.x = ceil(blueColor) - (quad2.y * 4.0); 
    texPos2 = texel.rg * 0.234375 + 0.0078125; 
    texPos1 = quad1 * 0.25 + texPos2; 
    texPos2 = quad2 * 0.25 + texPos2; 
    newColor1 = texture2D(lookUp, texPos1); 
    newColor2 = texture2D(lookUp, texPos2); 
    color = mix(newColor1.rgb, newColor2.rgb, fract(blueColor)); 
    newColor1Origin = texture2D(lookUpOrigin, texPos1); 
    newColor2Origin = texture2D(lookUpOrigin, texPos2); 
    colorOrigin = mix(newColor1Origin.rgb, newColor2Origin.rgb, fract(blueColor)); 
    gl_FragColor = vec4(mix(colorOrigin, color, alpha), 1.0); 
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).