You are on page 1of 2

///IS THIS EVEN USE?

///
/// COLOR CORRECTION (final pass) on a bitmap

#ifdef GL_ES
precision mediump float;
#endif
uniform sampler2D al_tex;
uniform sampler3D ColorGradingLUT;

uniform bool al_use_tex;


varying vec4 varying_color;
varying vec2 varying_texcoord;

const float lutSize = 16.0;


const vec3 scale = vec3((lutSize - 1.0) / lutSize);
const vec3 offset = vec3(1.0 / (2.0 * lutSize));

///for film noise haha


uniform float randSeed;
uniform float randSeed2;
uniform float noiseamount;

float rand(vec2 co){


return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
}

void main()
{
if (al_use_tex) {

vec4 rawColor = varying_color * texture2D(al_tex, varying_texcoord);


vec4 lutSample = texture3D(ColorGradingLUT, scale * texture2D(al_tex,
varying_texcoord).rgb + offset);

//gl_FragColor = lutSample;

float fval = rand( vec2(randSeed+gl_FragCoord.x, randSeed2


+gl_FragCoord.y));

float clampval = clamp(fval, 0.0,1.0);


//float clampval = min(max((fval, 0.0), 1.0).
gl_FragColor = lutSample + (noiseamount * clampval);

gl_FragColor.a = texture2D(al_tex, varying_texcoord).a;


///WHY WAS I DOING THIS? - it was responsible for the weird halo around
drop shadow images..
/*
if (gl_FragColor.a < 0.001) {
gl_FragColor.g=0;
gl_FragColor.r=0;
gl_FragColor.b=0;
gl_FragColor.a=0;
}
*/
} else {
gl_FragColor = varying_color;
}
}

You might also like