2012-10-07 23:41:18 -04:00
|
|
|
uniform sampler2D _CameraDepthTexture;
|
2014-02-11 02:06:13 -05:00
|
|
|
uniform sampler2D _CameraNormalsTexture;
|
|
|
|
uniform vec4 _LightColor;
|
|
|
|
uniform vec4 _LightPos;
|
|
|
|
uniform vec4 _LightPositionRange;
|
|
|
|
uniform vec4 _LightShadowData;
|
|
|
|
uniform samplerCube _LightTexture0;
|
|
|
|
uniform sampler2D _LightTextureB0;
|
|
|
|
uniform vec4 _ProjectionParams;
|
|
|
|
uniform samplerCube _ShadowMapTexture;
|
|
|
|
uniform mat4 _View2Shadow;
|
|
|
|
uniform mat4 _ViewToCookie;
|
|
|
|
uniform vec4 _ZBufferParams;
|
|
|
|
uniform vec4 unity_LightmapFade;
|
2012-10-07 23:41:18 -04:00
|
|
|
void main ()
|
|
|
|
{
|
|
|
|
vec4 tmpvar_1;
|
|
|
|
tmpvar_1 = gl_TexCoord[0];
|
|
|
|
vec3 tmpvar_2;
|
|
|
|
tmpvar_2 = gl_TexCoord[1].xyz;
|
|
|
|
vec4 res_3;
|
|
|
|
float atten_4;
|
|
|
|
vec3 lightDir_5;
|
2014-10-11 15:32:43 -04:00
|
|
|
vec3 tolight_6;
|
|
|
|
vec3 vpos_7;
|
|
|
|
vec3 normal_8;
|
|
|
|
vec2 uv_9;
|
|
|
|
uv_9 = (tmpvar_1.xy / tmpvar_1.w);
|
|
|
|
vec4 tmpvar_10;
|
|
|
|
tmpvar_10 = texture2D (_CameraNormalsTexture, uv_9);
|
|
|
|
normal_8 = ((tmpvar_10.xyz * 2.0) - 1.0);
|
|
|
|
normal_8 = normalize(normal_8);
|
|
|
|
vpos_7 = ((tmpvar_2 * (_ProjectionParams.z / tmpvar_2.z)) * (1.0/((
|
|
|
|
(_ZBufferParams.x * texture2D (_CameraDepthTexture, uv_9).x)
|
2014-02-11 02:06:13 -05:00
|
|
|
+ _ZBufferParams.y))));
|
2014-10-11 15:32:43 -04:00
|
|
|
tolight_6 = (_LightPos.xyz - vpos_7);
|
|
|
|
lightDir_5 = normalize(tolight_6);
|
|
|
|
atten_4 = texture2D (_LightTextureB0, vec2((dot (tolight_6, tolight_6) * _LightPos.w))).w;
|
2012-10-07 23:41:18 -04:00
|
|
|
vec3 vec_11;
|
2014-10-11 15:32:43 -04:00
|
|
|
vec_11 = -(tolight_6);
|
|
|
|
float mydist_12;
|
|
|
|
mat3 tmpvar_13;
|
|
|
|
tmpvar_13[0] = _View2Shadow[0].xyz;
|
|
|
|
tmpvar_13[1] = _View2Shadow[1].xyz;
|
|
|
|
tmpvar_13[2] = _View2Shadow[2].xyz;
|
|
|
|
vec_11 = (tmpvar_13 * vec_11);
|
|
|
|
mydist_12 = (sqrt(dot (vec_11, vec_11)) * _LightPositionRange.w);
|
|
|
|
mydist_12 = (mydist_12 * 0.97);
|
2012-10-07 23:41:18 -04:00
|
|
|
float tmpvar_14;
|
2014-10-11 15:32:43 -04:00
|
|
|
tmpvar_14 = dot (textureCube (_ShadowMapTexture, vec_11), vec4(1.0, 0.00392157, 1.53787e-05, 6.22737e-09));
|
2012-10-07 23:41:18 -04:00
|
|
|
float tmpvar_15;
|
2014-10-11 15:32:43 -04:00
|
|
|
if ((tmpvar_14 < mydist_12)) {
|
|
|
|
tmpvar_15 = _LightShadowData.x;
|
2012-10-07 23:41:18 -04:00
|
|
|
} else {
|
2014-10-11 15:32:43 -04:00
|
|
|
tmpvar_15 = 1.0;
|
2012-10-07 23:41:18 -04:00
|
|
|
};
|
2014-10-11 15:32:43 -04:00
|
|
|
atten_4 = (atten_4 * tmpvar_15);
|
|
|
|
vec4 tmpvar_16;
|
|
|
|
tmpvar_16.w = 1.0;
|
|
|
|
tmpvar_16.xyz = vpos_7;
|
|
|
|
atten_4 = (atten_4 * textureCube (_LightTexture0, (_ViewToCookie * tmpvar_16).xyz).w);
|
2014-02-11 02:06:13 -05:00
|
|
|
res_3.xyz = (_LightColor.xyz * (max (0.0,
|
2014-10-11 15:32:43 -04:00
|
|
|
dot (lightDir_5, normal_8)
|
|
|
|
) * atten_4));
|
2014-02-11 02:06:13 -05:00
|
|
|
res_3.w = ((pow (
|
|
|
|
max (0.0, dot (normalize((lightDir_5 -
|
2014-10-11 15:32:43 -04:00
|
|
|
normalize(vpos_7)
|
|
|
|
)), normal_8))
|
2014-02-11 02:06:13 -05:00
|
|
|
,
|
2014-10-11 15:32:43 -04:00
|
|
|
(tmpvar_10.w * 128.0)
|
|
|
|
) * clamp (atten_4, 0.0, 1.0)) * dot (_LightColor.xyz, vec3(0.22, 0.707, 0.071)));
|
|
|
|
res_3 = (res_3 * clamp ((1.0 -
|
|
|
|
((vpos_7.z * unity_LightmapFade.z) + unity_LightmapFade.w)
|
2014-02-11 02:06:13 -05:00
|
|
|
), 0.0, 1.0));
|
2014-10-11 15:32:43 -04:00
|
|
|
gl_FragData[0] = exp2(-(res_3));
|
2012-10-07 23:41:18 -04:00
|
|
|
}
|
|
|
|
|
2014-02-11 02:06:13 -05:00
|
|
|
|
2014-10-11 15:32:43 -04:00
|
|
|
// stats: 49 alu 5 tex 1 flow
|
|
|
|
// inputs: 1
|
|
|
|
// #0: gl_TexCoord (high float) 4x1 [2] loc 4
|
|
|
|
// uniforms: 9 (total size: 0)
|
|
|
|
// #0: _LightColor (high float) 4x1 [-1]
|
|
|
|
// #1: _LightPos (high float) 4x1 [-1]
|
|
|
|
// #2: _LightPositionRange (high float) 4x1 [-1]
|
|
|
|
// #3: _LightShadowData (high float) 4x1 [-1]
|
|
|
|
// #4: _ProjectionParams (high float) 4x1 [-1]
|
|
|
|
// #5: _View2Shadow (high float) 4x4 [-1]
|
|
|
|
// #6: _ViewToCookie (high float) 4x4 [-1]
|
|
|
|
// #7: _ZBufferParams (high float) 4x1 [-1]
|
|
|
|
// #8: unity_LightmapFade (high float) 4x1 [-1]
|
|
|
|
// textures: 5
|
|
|
|
// #0: _CameraDepthTexture (high 2d) 0x0 [-1]
|
|
|
|
// #1: _CameraNormalsTexture (high 2d) 0x0 [-1]
|
|
|
|
// #2: _LightTexture0 (high cube) 0x0 [-1]
|
|
|
|
// #3: _LightTextureB0 (high 2d) 0x0 [-1]
|
|
|
|
// #4: _ShadowMapTexture (high cube) 0x0 [-1]
|