highp vec3 Vignette( vec3 color){
highp float dist = length(screenSize);
color *= 1.0 - saturate(dist * 0.4);
return color;
}

mat3 ACESInputMat = mat3(0.59719, 0.35458, 0.04823, 0.07600, 0.90834, 0.01566, 0.02840, 0.13383, 0.83777);

mat3 ACESOutputMat = mat3(1.60475, -0.53108, -0.07367, -0.10208, 1.10813, -0.00605, -0.00327, -0.07276, 1.07602);

float Slope = 0.88;//0.88
float Toe = 0.55;//0.55
float Shoulder = 0.26;//0.26
float BlackClip = 0.0;//0.0
float WhiteClip = 0.04;//0.04

highp vec3 RRTAndODTFit(highp vec3 v){
highp vec3 a = v * (v + WhiteClip) - BlackClip;
highp vec3 b = v * (Slope * v + Toe) + Shoulder;
return a / b;
}

/*
const float overlap = 0.2;

const float rgOverlap = 0.1 * overlap;

const float rbOverlap = 0.01 * overlap;

const float gbOverlap = 0.04 * overlap;

const mat3 coneOverlap = mat3(1.0, rgOverlap, rbOverlap, rgOverlap, 1.0,  gbOverlap, rbOverlap, rgOverlap, 1.0);

const mat3 coneOverlapInverse = mat3(	1.0 + (rgOverlap + rbOverlap), -rgOverlap, -rbOverlap, -rgOverlap,  1.0 + (rgOverlap + gbOverlap),  -gbOverlap, -rbOverlap,  -rgOverlap, 1.0 + (rbOverlap + rgOverlap));
*/

highp vec3 Tonemap(highp vec3 color){

color = color * ACESInputMat;

color = RRTAndODTFit(color);

color = color * ACESOutputMat;

color = saturate(color);

return pow(color,vec3(1.0/2.2));
}

/*
highp vec3 Tonemap(highp vec3 x) {
   float a = 1.0;
   float b = 0.0;
   float c = 1.0;
   float d = 1.0;
   float e = 0.04;
   x = pow(x,vec3(2.0));
  return pow(saturate((x * (a * x + b)) / (x * (c * x + d) + e)),vec3(1.0/4.2));
}*/