struct v2f { highp vec4 pos; highp vec4 uv; highp vec3 ray; }; 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 samplerCube _LightTexture0; uniform sampler2D _LightTextureB0; uniform highp vec4 _ProjectionParams; uniform 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; float xll_saturate ( in float x_1 ) { float tmpvar_2; tmpvar_2 = clamp (x_1, 0.0, 1.0); return tmpvar_2; } vec2 xll_saturate ( in vec2 x_3 ) { vec2 tmpvar_4; tmpvar_4 = clamp (x_3, 0.0, 1.0); return tmpvar_4; } vec3 xll_saturate ( in vec3 x_5 ) { vec3 tmpvar_6; tmpvar_6 = clamp (x_5, 0.0, 1.0); return tmpvar_6; } vec4 xll_saturate ( in vec4 x_7 ) { vec4 tmpvar_8; tmpvar_8 = clamp (x_7, 0.0, 1.0); return tmpvar_8; } mat2 xll_saturate ( in mat2 m_9 ) { vec2 tmpvar_10; tmpvar_10 = clamp (m_9[0], 0.0, 1.0); vec2 tmpvar_11; tmpvar_11 = clamp (m_9[1], 0.0, 1.0); mat2 tmpvar_12; vec2 tmpvar_13; tmpvar_13 = tmpvar_10; tmpvar_12[0] = tmpvar_13; vec2 tmpvar_14; tmpvar_14 = tmpvar_11; tmpvar_12[1] = tmpvar_14; return tmpvar_12; } mat3 xll_saturate ( in mat3 m_15 ) { vec3 tmpvar_16; tmpvar_16 = clamp (m_15[0], 0.0, 1.0); vec3 tmpvar_17; tmpvar_17 = clamp (m_15[1], 0.0, 1.0); vec3 tmpvar_18; tmpvar_18 = clamp (m_15[2], 0.0, 1.0); mat3 tmpvar_19; vec3 tmpvar_20; tmpvar_20 = tmpvar_16; tmpvar_19[0] = tmpvar_20; vec3 tmpvar_21; tmpvar_21 = tmpvar_17; tmpvar_19[1] = tmpvar_21; vec3 tmpvar_22; tmpvar_22 = tmpvar_18; tmpvar_19[2] = tmpvar_22; return tmpvar_19; } mat4 xll_saturate ( in mat4 m_23 ) { vec4 tmpvar_24; tmpvar_24 = clamp (m_23[0], 0.0, 1.0); vec4 tmpvar_25; tmpvar_25 = clamp (m_23[1], 0.0, 1.0); vec4 tmpvar_26; tmpvar_26 = clamp (m_23[2], 0.0, 1.0); vec4 tmpvar_27; tmpvar_27 = clamp (m_23[3], 0.0, 1.0); mat4 tmpvar_28; vec4 tmpvar_29; tmpvar_29 = tmpvar_24; tmpvar_28[0] = tmpvar_29; vec4 tmpvar_30; tmpvar_30 = tmpvar_25; tmpvar_28[1] = tmpvar_30; vec4 tmpvar_31; tmpvar_31 = tmpvar_26; tmpvar_28[2] = tmpvar_31; vec4 tmpvar_32; tmpvar_32 = tmpvar_27; tmpvar_28[3] = tmpvar_32; return tmpvar_28; } vec2 xll_vecTSel ( in bvec2 a_33, in vec2 b_34, in vec2 c_35 ) { float tmpvar_36; if (a_33.x) { tmpvar_36 = b_34.x; } else { tmpvar_36 = c_35.x; }; float tmpvar_37; if (a_33.y) { tmpvar_37 = b_34.y; } else { tmpvar_37 = c_35.y; }; vec2 tmpvar_38; tmpvar_38.x = tmpvar_36; tmpvar_38.y = tmpvar_37; return tmpvar_38; } vec3 xll_vecTSel ( in bvec3 a_39, in vec3 b_40, in vec3 c_41 ) { float tmpvar_42; if (a_39.x) { tmpvar_42 = b_40.x; } else { tmpvar_42 = c_41.x; }; float tmpvar_43; if (a_39.y) { tmpvar_43 = b_40.y; } else { tmpvar_43 = c_41.y; }; float tmpvar_44; if (a_39.z) { tmpvar_44 = b_40.z; } else { tmpvar_44 = c_41.z; }; vec3 tmpvar_45; tmpvar_45.x = tmpvar_42; tmpvar_45.y = tmpvar_43; tmpvar_45.z = tmpvar_44; return tmpvar_45; } vec4 xll_vecTSel ( in bvec4 a_46, in vec4 b_47, in vec4 c_48 ) { float tmpvar_49; if (a_46.x) { tmpvar_49 = b_47.x; } else { tmpvar_49 = c_48.x; }; float tmpvar_50; if (a_46.y) { tmpvar_50 = b_47.y; } else { tmpvar_50 = c_48.y; }; float tmpvar_51; if (a_46.z) { tmpvar_51 = b_47.z; } else { tmpvar_51 = c_48.z; }; float tmpvar_52; if (a_46.w) { tmpvar_52 = b_47.w; } else { tmpvar_52 = c_48.w; }; vec4 tmpvar_53; tmpvar_53.x = tmpvar_49; tmpvar_53.y = tmpvar_50; tmpvar_53.z = tmpvar_51; tmpvar_53.w = tmpvar_52; return tmpvar_53; } mediump float Luminance ( in mediump vec3 c_54 ) { mediump float tmpvar_55; tmpvar_55 = dot (c_54, vec3(0.22, 0.707, 0.071)); return tmpvar_55; } float Linear01Depth ( in highp float z_56 ) { return (1.0 / ((_ZBufferParams.x * z_56) + _ZBufferParams.y)); } float DecodeFloatRGBA ( in highp vec4 enc_57 ) { highp vec4 kDecodeDot_58; vec4 tmpvar_59; tmpvar_59 = vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09); kDecodeDot_58 = tmpvar_59; highp float tmpvar_60; tmpvar_60 = dot (enc_57, kDecodeDot_58); return tmpvar_60; } float SampleCubeDistance ( in highp vec3 vec_61 ) { highp vec4 packDist_62; lowp vec4 tmpvar_63; tmpvar_63 = textureCube (_ShadowMapTexture, vec_61); lowp vec4 tmpvar_64; tmpvar_64 = tmpvar_63; packDist_62 = tmpvar_64; highp float tmpvar_65; tmpvar_65 = DecodeFloatRGBA (packDist_62); return tmpvar_65; } mediump float unitySampleShadow ( in highp vec3 vec_66, in highp float mydist_67 ) { mediump vec4 shadows_68; highp vec4 shadowVals_69; highp float z_70; float tmpvar_71; tmpvar_71 = 0.0078125; z_70 = tmpvar_71; highp vec3 tmpvar_72; tmpvar_72.x = z_70; tmpvar_72.y = z_70; tmpvar_72.z = z_70; highp float tmpvar_73; tmpvar_73 = SampleCubeDistance ((vec_66 + tmpvar_72)); highp float tmpvar_74; tmpvar_74 = tmpvar_73; shadowVals_69.x = tmpvar_74; highp vec3 tmpvar_75; tmpvar_75.x = -(z_70); tmpvar_75.y = -(z_70); tmpvar_75.z = z_70; highp float tmpvar_76; tmpvar_76 = SampleCubeDistance ((vec_66 + tmpvar_75)); highp float tmpvar_77; tmpvar_77 = tmpvar_76; shadowVals_69.y = vec2(tmpvar_77).y; highp vec3 tmpvar_78; tmpvar_78.x = -(z_70); tmpvar_78.y = z_70; tmpvar_78.z = -(z_70); highp float tmpvar_79; tmpvar_79 = SampleCubeDistance ((vec_66 + tmpvar_78)); highp float tmpvar_80; tmpvar_80 = tmpvar_79; shadowVals_69.z = vec3(tmpvar_80).z; highp vec3 tmpvar_81; tmpvar_81.x = z_70; tmpvar_81.y = -(z_70); tmpvar_81.z = -(z_70); highp float tmpvar_82; tmpvar_82 = SampleCubeDistance ((vec_66 + tmpvar_81)); highp float tmpvar_83; tmpvar_83 = tmpvar_82; shadowVals_69.w = vec4(tmpvar_83).w; highp vec4 tmpvar_84; tmpvar_84 = vec4(mydist_67); highp vec4 tmpvar_85; tmpvar_85 = tmpvar_84.xyzw; bvec4 tmpvar_86; tmpvar_86 = lessThan (shadowVals_69, tmpvar_85); highp vec4 tmpvar_87; tmpvar_87 = _LightShadowData.xxxx.xyzw; vec4 tmpvar_88; tmpvar_88 = xll_vecTSel (tmpvar_86, tmpvar_87, vec4(1.0, 1.0, 1.0, 1.0)); vec4 tmpvar_89; tmpvar_89 = tmpvar_88; shadows_68 = tmpvar_89; mediump float tmpvar_90; tmpvar_90 = dot (shadows_68, vec4(0.25, 0.25, 0.25, 0.25)); return tmpvar_90; } mediump float ComputeShadow ( in highp vec3 vec_91, in highp float z_92, in highp vec2 uv_93 ) { highp float mydist_94; highp float fade_95; highp float tmpvar_96; tmpvar_96 = ((z_92 * _LightShadowData.z) + _LightShadowData.w); fade_95 = tmpvar_96; float tmpvar_97; tmpvar_97 = xll_saturate (fade_95); float tmpvar_98; tmpvar_98 = tmpvar_97; fade_95 = tmpvar_98; highp float tmpvar_99; tmpvar_99 = length (vec_91); highp float tmpvar_100; tmpvar_100 = (tmpvar_99 * _LightPositionRange.w); mydist_94 = tmpvar_100; highp float tmpvar_101; tmpvar_101 = (mydist_94 * 0.97); mydist_94 = tmpvar_101; mediump float tmpvar_102; tmpvar_102 = unitySampleShadow (vec_91, mydist_94); return tmpvar_102; return 1.0; } mediump vec4 xlat_main ( in v2f i_103 ) { highp float fade_104; mediump vec4 res_105; highp float spec_106; mediump vec3 h_107; mediump float diff_108; highp float atten_109; highp float att_110; mediump vec3 lightDir_111; highp vec3 tolight_112; highp vec3 wpos_113; highp vec4 vpos_114; highp float depth_115; mediump vec3 normal_116; mediump vec4 nspec_117; highp vec2 uv_118; highp vec3 tmpvar_119; tmpvar_119 = (i_103.ray * (_ProjectionParams.z / i_103.ray.z)); i_103.ray = tmpvar_119; highp vec2 tmpvar_120; tmpvar_120 = (i_103.uv.xy / i_103.uv.w); uv_118 = tmpvar_120; lowp vec4 tmpvar_121; tmpvar_121 = texture2D (_CameraNormalsTexture, uv_118); lowp vec4 tmpvar_122; tmpvar_122 = tmpvar_121; nspec_117 = tmpvar_122; mediump vec3 tmpvar_123; tmpvar_123 = ((nspec_117.xyz * 2.0) - 1.0); normal_116 = tmpvar_123; mediump vec3 tmpvar_124; tmpvar_124 = normalize (normal_116); mediump vec3 tmpvar_125; tmpvar_125 = tmpvar_124; normal_116 = tmpvar_125; lowp vec4 tmpvar_126; tmpvar_126 = texture2D (_CameraDepthTexture, uv_118); lowp float tmpvar_127; tmpvar_127 = tmpvar_126.x; depth_115 = tmpvar_127; highp float tmpvar_128; tmpvar_128 = Linear01Depth (depth_115); highp float tmpvar_129; tmpvar_129 = tmpvar_128; depth_115 = tmpvar_129; highp vec4 tmpvar_130; tmpvar_130.w = 1.0; tmpvar_130.xyz = (i_103.ray * depth_115).xyz; highp vec4 tmpvar_131; tmpvar_131 = tmpvar_130; vpos_114 = tmpvar_131; highp vec3 tmpvar_132; tmpvar_132 = (_CameraToWorld * vpos_114).xyz; wpos_113 = tmpvar_132; highp vec3 tmpvar_133; tmpvar_133 = (wpos_113 - _LightPos.xyz); tolight_112 = tmpvar_133; highp vec3 tmpvar_134; tmpvar_134 = normalize (tolight_112); highp vec3 tmpvar_135; tmpvar_135 = -(tmpvar_134); lightDir_111 = tmpvar_135; highp float tmpvar_136; tmpvar_136 = dot (tolight_112, tolight_112); highp float tmpvar_137; tmpvar_137 = (tmpvar_136 * _LightPos.w); att_110 = tmpvar_137; highp vec2 tmpvar_138; tmpvar_138 = vec2(att_110); highp vec2 tmpvar_139; tmpvar_139 = tmpvar_138.xy; lowp vec4 tmpvar_140; tmpvar_140 = texture2D (_LightTextureB0, tmpvar_139); lowp float tmpvar_141; tmpvar_141 = tmpvar_140.w; atten_109 = tmpvar_141; mediump float tmpvar_142; tmpvar_142 = ComputeShadow (tolight_112, vpos_114.z, uv_118); highp float tmpvar_143; tmpvar_143 = (atten_109 * tmpvar_142); atten_109 = tmpvar_143; highp vec4 tmpvar_144; tmpvar_144.w = 1.0; tmpvar_144.xyz = wpos_113.xyz; lowp vec4 tmpvar_145; tmpvar_145 = textureCube (_LightTexture0, (_LightMatrix0 * tmpvar_144).xyz); highp float tmpvar_146; tmpvar_146 = (atten_109 * tmpvar_145.w); atten_109 = tmpvar_146; mediump float tmpvar_147; tmpvar_147 = dot (lightDir_111, normal_116); mediump float tmpvar_148; tmpvar_148 = max (0.0, tmpvar_147); mediump float tmpvar_149; tmpvar_149 = tmpvar_148; diff_108 = tmpvar_149; highp vec3 tmpvar_150; tmpvar_150 = normalize ((wpos_113 - _WorldSpaceCameraPos)); highp vec3 tmpvar_151; tmpvar_151 = normalize ((lightDir_111 - tmpvar_150)); highp vec3 tmpvar_152; tmpvar_152 = tmpvar_151; h_107 = tmpvar_152; mediump float tmpvar_153; tmpvar_153 = dot (h_107, normal_116); mediump float tmpvar_154; tmpvar_154 = max (0.0, tmpvar_153); mediump float tmpvar_155; tmpvar_155 = pow (tmpvar_154, (nspec_117.w * 128.0)); mediump float tmpvar_156; tmpvar_156 = tmpvar_155; spec_106 = tmpvar_156; float tmpvar_157; tmpvar_157 = xll_saturate (atten_109); highp float tmpvar_158; tmpvar_158 = (spec_106 * tmpvar_157); spec_106 = tmpvar_158; highp vec3 tmpvar_159; tmpvar_159 = (_LightColor.xyz * (diff_108 * atten_109)); res_105.xyz = tmpvar_159.xyz.xyz; mediump float tmpvar_160; tmpvar_160 = Luminance (_LightColor.xyz); highp float tmpvar_161; tmpvar_161 = (spec_106 * tmpvar_160); res_105.w = vec4(tmpvar_161).w; highp float tmpvar_162; tmpvar_162 = ((vpos_114.z * unity_LightmapFade.z) + unity_LightmapFade.w); fade_104 = tmpvar_162; float tmpvar_163; tmpvar_163 = xll_saturate ((1.0 - fade_104)); mediump vec4 tmpvar_164; tmpvar_164 = (res_105 * tmpvar_163); res_105 = tmpvar_164; mediump vec4 tmpvar_165; tmpvar_165 = exp2 (-(res_105)); return tmpvar_165; } void main () { v2f xlt_i_166; mediump vec4 xl_retval_167; vec4 tmpvar_168; tmpvar_168 = vec4(0.0, 0.0, 0.0, 0.0); xlt_i_166.pos = tmpvar_168; highp vec4 tmpvar_169; tmpvar_169 = xlv_TEXCOORD0.xyzw; highp vec4 tmpvar_170; tmpvar_170 = tmpvar_169; xlt_i_166.uv = tmpvar_170; highp vec3 tmpvar_171; tmpvar_171 = xlv_TEXCOORD1.xyz; highp vec3 tmpvar_172; tmpvar_172 = tmpvar_171; xlt_i_166.ray = tmpvar_172; mediump vec4 tmpvar_173; tmpvar_173 = xlat_main (xlt_i_166); mediump vec4 tmpvar_174; tmpvar_174 = tmpvar_173; xl_retval_167 = tmpvar_174; mediump vec4 tmpvar_175; tmpvar_175 = xl_retval_167.xyzw; mediump vec4 tmpvar_176; tmpvar_176 = tmpvar_175; gl_FragData[0] = tmpvar_176; }