uniform sampler2D _CameraDepthNormalsTexture;
uniform sampler2D _RandomTexture;
uniform highp vec4 _Params;
uniform highp vec4 _ProjectionParams;
varying highp vec2 xlv_TEXCOORD0;
varying highp vec2 xlv_TEXCOORD1;
void main ()
{
  highp vec3 RAND_SAMPLES_1[8];
  RAND_SAMPLES_1[0] = vec3(0.0130572, 0.587232, -0.119337);
  RAND_SAMPLES_1[1] = vec3(0.323078, 0.0220727, -0.418873);
  RAND_SAMPLES_1[2] = vec3(-0.310725, -0.191367, 0.0561369);
  RAND_SAMPLES_1[3] = vec3(-0.479646, 0.0939877, -0.580265);
  RAND_SAMPLES_1[4] = vec3(0.139999, -0.33577, 0.559679);
  RAND_SAMPLES_1[5] = vec3(-0.248458, 0.255532, 0.348944);
  RAND_SAMPLES_1[6] = vec3(0.18719, -0.702764, -0.231748);
  RAND_SAMPLES_1[7] = vec3(0.884915, 0.284208, 0.368524);
  mediump float tmpvar_2;
  highp vec2 tmpvar_3;
  tmpvar_3 = xlv_TEXCOORD0;
  highp vec3 samples_4[8];
  samples_4[0]=RAND_SAMPLES_1[0];samples_4[1]=RAND_SAMPLES_1[1];samples_4[2]=RAND_SAMPLES_1[2];samples_4[3]=RAND_SAMPLES_1[3];samples_4[4]=RAND_SAMPLES_1[4];samples_4[5]=RAND_SAMPLES_1[5];samples_4[6]=RAND_SAMPLES_1[6];samples_4[7]=RAND_SAMPLES_1[7];
  highp float occ_6;
  highp float scale_7;
  highp float depth_8;
  highp vec3 viewNorm_9;
  highp vec4 depthnormal_10;
  mediump vec3 randN_11;
  lowp vec3 tmpvar_12;
  tmpvar_12 = ((texture2D (_RandomTexture, xlv_TEXCOORD1).xyz * 2.0) - 1.0);
  randN_11 = tmpvar_12;
  lowp vec4 tmpvar_13;
  tmpvar_13 = texture2D (_CameraDepthNormalsTexture, xlv_TEXCOORD0);
  depthnormal_10 = tmpvar_13;
  highp vec3 n_14;
  highp vec3 tmpvar_15;
  tmpvar_15 = ((depthnormal_10.xyz * vec3(3.5554, 3.5554, 0.0)) + vec3(-1.7777, -1.7777, 1.0));
  highp float tmpvar_16;
  tmpvar_16 = (2.0 / dot (tmpvar_15, tmpvar_15));
  n_14.xy = (tmpvar_16 * tmpvar_15.xy);
  n_14.z = (tmpvar_16 - 1.0);
  viewNorm_9 = n_14;
  depth_8 = (dot (depthnormal_10.zw, vec2(1.0, 0.00392157)) * _ProjectionParams.z);
  scale_7 = (_Params.x / depth_8);
  occ_6 = 0.0;
  for (int s_5 = 0; s_5 < 8; s_5++) {
    highp vec4 sampleND_17;
    mediump vec3 randomDir_18;
    highp vec3 tmpvar_19;
    highp vec3 I_20;
    I_20 = samples_4[s_5];
    tmpvar_19 = (I_20 - (2.0 * (
      dot (randN_11, I_20)
     * randN_11)));
    randomDir_18 = tmpvar_19;
    highp float tmpvar_21;
    tmpvar_21 = dot (viewNorm_9, randomDir_18);
    highp float tmpvar_22;
    if ((tmpvar_21 < 0.0)) {
      tmpvar_22 = 1.0;
    } else {
      tmpvar_22 = -1.0;
    };
    randomDir_18 = (randomDir_18 * -(tmpvar_22));
    randomDir_18 = (randomDir_18 + (viewNorm_9 * 0.3));
    lowp vec4 tmpvar_23;
    highp vec2 P_24;
    P_24 = (tmpvar_3 + (randomDir_18.xy * scale_7));
    tmpvar_23 = texture2D (_CameraDepthNormalsTexture, P_24);
    sampleND_17 = tmpvar_23;
    highp float tmpvar_25;
    tmpvar_25 = clamp (((depth_8 - 
      (randomDir_18.z * _Params.x)
    ) - (
      dot (sampleND_17.zw, vec2(1.0, 0.00392157))
     * _ProjectionParams.z)), 0.0, 1.0);
    if ((tmpvar_25 > _Params.y)) {
      occ_6 = (occ_6 + pow ((1.0 - tmpvar_25), _Params.z));
    };
  };
  occ_6 = (occ_6 / 8.0);
  tmpvar_2 = (1.0 - occ_6);
  gl_FragData[0] = vec4(tmpvar_2);
}


// stats: 49 alu 3 tex 4 flow
// inputs: 2
//  #0: xlv_TEXCOORD0 (high float) 2x1 [-1]
//  #1: xlv_TEXCOORD1 (high float) 2x1 [-1]
// uniforms: 2 (total size: 0)
//  #0: _Params (high float) 4x1 [-1]
//  #1: _ProjectionParams (high float) 4x1 [-1]
// textures: 2
//  #0: _CameraDepthNormalsTexture (low 2d) 0x0 [-1]
//  #1: _RandomTexture (low 2d) 0x0 [-1]
