uniform sampler2D _ScratchTex;
uniform sampler2D _MainTex;
uniform vec4 _Intensity;
uniform sampler2D _GrainTex;
void main ()
{
  vec3 yuv_1;
  vec4 col_2;
  vec4 tmpvar_3;
  tmpvar_3 = texture2D (_MainTex, gl_TexCoord[0].xy);
  col_2.w = tmpvar_3.w;
  yuv_1.x = dot (tmpvar_3.xyz, vec3(0.299, 0.587, 0.114));
  yuv_1.y = ((tmpvar_3.z - yuv_1.x) * 0.492);
  yuv_1.z = ((tmpvar_3.x - yuv_1.x) * 0.877);
  yuv_1 = (yuv_1 + (((texture2D (_GrainTex, gl_TexCoord[1].xy).xyz * 2.0) - 1.0) * _Intensity.x));
  col_2.x = ((yuv_1.z * 1.14) + yuv_1.x);
  col_2.y = (((yuv_1.z * -0.581) + (yuv_1.y * -0.395)) + yuv_1.x);
  col_2.z = ((yuv_1.y * 2.032) + yuv_1.x);
  col_2.xyz = (col_2.xyz + (((texture2D (_ScratchTex, gl_TexCoord[2].xy).xyz * 2.0) - 1.0) * _Intensity.y));
  gl_FragData[0] = col_2;
}

