uniform sampler2D _CameraDepthTexture;
uniform sampler2D _CameraNormalsTexture;
uniform highp mat4 _CameraToWorld;
uniform highp vec4 _LightColor;
uniform highp mat4 _LightMatrix0;
uniform highp vec4 _LightPos;
uniform highp vec4 _LightPositionRange;
uniform highp vec4 _LightShadowData;
uniform lowp samplerCube _LightTexture0;
uniform sampler2D _LightTextureB0;
uniform highp vec4 _ProjectionParams;
uniform lowp samplerCube _ShadowMapTexture;
uniform highp vec3 _WorldSpaceCameraPos;
uniform highp vec4 _ZBufferParams;
uniform highp vec4 unity_LightmapFade;
varying highp vec4 xlv_TEXCOORD0;
varying highp vec3 xlv_TEXCOORD1;
void main ()
{
  mediump vec4 res_1;
  highp float spec_2;
  mediump vec3 h_3;
  highp float atten_4;
  mediump vec3 lightDir_5;
  highp vec3 tolight_6;
  highp vec3 wpos_7;
  highp float depth_8;
  mediump vec3 normal_9;
  mediump vec4 nspec_10;
  highp vec2 uv_11;
  uv_11 = (xlv_TEXCOORD0.xy / xlv_TEXCOORD0.w);
  lowp vec4 tmpvar_12;
  tmpvar_12 = texture2D (_CameraNormalsTexture, uv_11);
  nspec_10 = tmpvar_12;
  normal_9 = ((nspec_10.xyz * 2.0) - 1.0);
  normal_9 = normalize(normal_9);
  lowp vec4 tmpvar_13;
  tmpvar_13 = texture2D (_CameraDepthTexture, uv_11);
  depth_8 = tmpvar_13.x;
  highp float tmpvar_14;
  tmpvar_14 = (1.0/(((_ZBufferParams.x * depth_8) + _ZBufferParams.y)));
  depth_8 = tmpvar_14;
  highp vec4 tmpvar_15;
  tmpvar_15.w = 1.0;
  tmpvar_15.xyz = ((xlv_TEXCOORD1 * (_ProjectionParams.z / xlv_TEXCOORD1.z)) * tmpvar_14);
  wpos_7 = (_CameraToWorld * tmpvar_15).xyz;
  tolight_6 = (wpos_7 - _LightPos.xyz);
  highp vec3 tmpvar_16;
  tmpvar_16 = normalize(tolight_6);
  lightDir_5 = -(tmpvar_16);
  highp vec2 tmpvar_17;
  tmpvar_17 = vec2((dot (tolight_6, tolight_6) * _LightPos.w));
  lowp vec4 tmpvar_18;
  tmpvar_18 = texture2D (_LightTextureB0, tmpvar_17);
  atten_4 = tmpvar_18.w;
  highp float mydist_19;
  mydist_19 = (sqrt(dot (tolight_6, tolight_6)) * _LightPositionRange.w);
  mydist_19 = (mydist_19 * 0.97);
  mediump vec4 shadows_20;
  highp vec4 shadowVals_21;
  highp vec3 vec_22;
  vec_22 = (tolight_6 + vec3(0.0078125, 0.0078125, 0.0078125));
  highp vec4 packDist_23;
  lowp vec4 tmpvar_24;
  tmpvar_24 = textureCube (_ShadowMapTexture, vec_22);
  packDist_23 = tmpvar_24;
  shadowVals_21.x = dot (packDist_23, vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
  highp vec3 vec_25;
  vec_25 = (tolight_6 + vec3(-0.0078125, -0.0078125, 0.0078125));
  highp vec4 packDist_26;
  lowp vec4 tmpvar_27;
  tmpvar_27 = textureCube (_ShadowMapTexture, vec_25);
  packDist_26 = tmpvar_27;
  shadowVals_21.y = dot (packDist_26, vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
  highp vec3 vec_28;
  vec_28 = (tolight_6 + vec3(-0.0078125, 0.0078125, -0.0078125));
  highp vec4 packDist_29;
  lowp vec4 tmpvar_30;
  tmpvar_30 = textureCube (_ShadowMapTexture, vec_28);
  packDist_29 = tmpvar_30;
  shadowVals_21.z = dot (packDist_29, vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
  highp vec3 vec_31;
  vec_31 = (tolight_6 + vec3(0.0078125, -0.0078125, -0.0078125));
  highp vec4 packDist_32;
  lowp vec4 tmpvar_33;
  tmpvar_33 = textureCube (_ShadowMapTexture, vec_31);
  packDist_32 = tmpvar_33;
  shadowVals_21.w = dot (packDist_32, vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
  bvec4 tmpvar_34;
  tmpvar_34 = lessThan (shadowVals_21, vec4(mydist_19));
  highp vec4 tmpvar_35;
  tmpvar_35 = _LightShadowData.xxxx;
  highp float tmpvar_36;
  if (tmpvar_34.x) {
    tmpvar_36 = tmpvar_35.x;
  } else {
    tmpvar_36 = 1.0;
  };
  highp float tmpvar_37;
  if (tmpvar_34.y) {
    tmpvar_37 = tmpvar_35.y;
  } else {
    tmpvar_37 = 1.0;
  };
  highp float tmpvar_38;
  if (tmpvar_34.z) {
    tmpvar_38 = tmpvar_35.z;
  } else {
    tmpvar_38 = 1.0;
  };
  highp float tmpvar_39;
  if (tmpvar_34.w) {
    tmpvar_39 = tmpvar_35.w;
  } else {
    tmpvar_39 = 1.0;
  };
  highp vec4 tmpvar_40;
  tmpvar_40.x = tmpvar_36;
  tmpvar_40.y = tmpvar_37;
  tmpvar_40.z = tmpvar_38;
  tmpvar_40.w = tmpvar_39;
  shadows_20 = tmpvar_40;
  mediump float tmpvar_41;
  tmpvar_41 = dot (shadows_20, vec4(0.25, 0.25, 0.25, 0.25));
  atten_4 = (atten_4 * tmpvar_41);
  highp vec4 tmpvar_42;
  tmpvar_42.w = 1.0;
  tmpvar_42.xyz = wpos_7;
  lowp vec4 tmpvar_43;
  highp vec3 P_44;
  P_44 = (_LightMatrix0 * tmpvar_42).xyz;
  tmpvar_43 = textureCube (_LightTexture0, P_44);
  atten_4 = (atten_4 * tmpvar_43.w);
  highp vec3 tmpvar_45;
  tmpvar_45 = normalize((lightDir_5 - normalize(
    (wpos_7 - _WorldSpaceCameraPos)
  )));
  h_3 = tmpvar_45;
  mediump float tmpvar_46;
  tmpvar_46 = pow (max (0.0, dot (h_3, normal_9)), (nspec_10.w * 128.0));
  spec_2 = tmpvar_46;
  spec_2 = (spec_2 * clamp (atten_4, 0.0, 1.0));
  res_1.xyz = (_LightColor.xyz * (max (0.0, 
    dot (lightDir_5, normal_9)
  ) * atten_4));
  mediump vec3 c_47;
  c_47 = _LightColor.xyz;
  res_1.w = (spec_2 * dot (c_47, vec3(0.22, 0.707, 0.071)));
  highp float tmpvar_48;
  tmpvar_48 = clamp ((1.0 - (
    (tmpvar_15.z * unity_LightmapFade.z)
   + unity_LightmapFade.w)), 0.0, 1.0);
  res_1 = (res_1 * tmpvar_48);
  gl_FragData[0] = exp2(-(res_1));
}


// stats: 62 alu 8 tex 4 flow
// inputs: 2
//  #0: xlv_TEXCOORD0 (high float) 4x1 [-1]
//  #1: xlv_TEXCOORD1 (high float) 3x1 [-1]
// uniforms: 10 (total size: 0)
//  #0: _CameraToWorld (high float) 4x4 [-1]
//  #1: _LightColor (high float) 4x1 [-1]
//  #2: _LightMatrix0 (high float) 4x4 [-1]
//  #3: _LightPos (high float) 4x1 [-1]
//  #4: _LightPositionRange (high float) 4x1 [-1]
//  #5: _LightShadowData (high float) 4x1 [-1]
//  #6: _ProjectionParams (high float) 4x1 [-1]
//  #7: _WorldSpaceCameraPos (high float) 3x1 [-1]
//  #8: _ZBufferParams (high float) 4x1 [-1]
//  #9: unity_LightmapFade (high float) 4x1 [-1]
// textures: 5
//  #0: _CameraDepthTexture (low 2d) 0x0 [-1]
//  #1: _CameraNormalsTexture (low 2d) 0x0 [-1]
//  #2: _LightTexture0 (low cube) 0x0 [-1]
//  #3: _LightTextureB0 (low 2d) 0x0 [-1]
//  #4: _ShadowMapTexture (low cube) 0x0 [-1]
