float xll_saturate_f( float x) { return clamp( x, 0.0, 1.0); } vec2 xll_saturate_vf2( vec2 x) { return clamp( x, 0.0, 1.0); } vec3 xll_saturate_vf3( vec3 x) { return clamp( x, 0.0, 1.0); } vec4 xll_saturate_vf4( vec4 x) { return clamp( x, 0.0, 1.0); } mat2 xll_saturate_mf2x2(mat2 m) { return mat2( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0)); } mat3 xll_saturate_mf3x3(mat3 m) { return mat3( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0), clamp(m[2], 0.0, 1.0)); } mat4 xll_saturate_mf4x4(mat4 m) { return mat4( clamp(m[0], 0.0, 1.0), clamp(m[1], 0.0, 1.0), clamp(m[2], 0.0, 1.0), clamp(m[3], 0.0, 1.0)); } vec2 xll_vecTSel_vb2_vf2_vf2 (bvec2 a, vec2 b, vec2 c) { return vec2 (a.x ? b.x : c.x, a.y ? b.y : c.y); } vec3 xll_vecTSel_vb3_vf3_vf3 (bvec3 a, vec3 b, vec3 c) { return vec3 (a.x ? b.x : c.x, a.y ? b.y : c.y, a.z ? b.z : c.z); } vec4 xll_vecTSel_vb4_vf4_vf4 (bvec4 a, vec4 b, vec4 c) { return vec4 (a.x ? b.x : c.x, a.y ? b.y : c.y, a.z ? b.z : c.z, a.w ? b.w : c.w); } #line 19 struct v2f { highp vec4 pos; highp vec4 uv; highp vec3 ray; }; #line 1 uniform highp vec4 _ProjectionParams; uniform highp vec3 _WorldSpaceCameraPos; uniform highp vec4 _LightPositionRange; uniform highp vec4 _ZBufferParams; #line 14 #line 18 uniform highp vec4 unity_LightShadowBias; #line 26 uniform sampler2D _CameraNormalsTexture; uniform sampler2D _CameraDepthTexture; uniform highp vec4 _LightDir; uniform highp vec4 _LightPos; #line 30 uniform highp vec4 _LightColor; uniform highp vec4 _LightShadowData; uniform highp vec4 unity_LightmapFade; uniform highp mat4 _CameraToWorld; #line 34 uniform highp mat4 _LightMatrix0; uniform sampler2D _LightTextureB0; uniform samplerCube _LightTexture0; uniform samplerCube _ShadowMapTexture; #line 38 uniform highp mat4 unity_World2Shadow; #line 55 #line 64 #line 8 highp float DecodeFloatRGBA( in highp vec4 enc ) { #line 10 highp vec4 kDecodeDot = vec4( 1.0, 0.003921569, 1.53787e-05, 6.227372e-09); return dot( enc, kDecodeDot); } #line 39 highp float SampleCubeDistance( in highp vec3 vec ) { highp vec4 packDist = texture( _ShadowMapTexture, vec); #line 42 return DecodeFloatRGBA( packDist); } #line 44 mediump float unitySampleShadow( in highp vec3 vec, in highp float mydist ) { #line 46 highp float z = 0.0078125; highp vec4 shadowVals; shadowVals.x = SampleCubeDistance( (vec + vec3( z, z, z))); shadowVals.y = SampleCubeDistance( (vec + vec3( (-z), (-z), z))); #line 50 shadowVals.z = SampleCubeDistance( (vec + vec3( (-z), z, (-z)))); shadowVals.w = SampleCubeDistance( (vec + vec3( z, (-z), (-z)))); mediump vec4 shadows = xll_vecTSel_vb4_vf4_vf4 (lessThan( shadowVals, vec4( mydist)), vec4( _LightShadowData.xxxx), vec4( 1.0)); return dot( shadows, vec4( 0.25)); } #line 55 mediump float ComputeShadow( in highp vec3 vec, in highp float z, in highp vec2 uv ) { highp float fade = ((z * _LightShadowData.z) + _LightShadowData.w); fade = xll_saturate_f(fade); #line 59 highp float mydist = (length(vec) * _LightPositionRange.w); mydist *= 0.97; return unitySampleShadow( vec, mydist); return 1.0; } #line 14 highp float Linear01Depth( in highp float z ) { return (1.0 / ((_ZBufferParams.x * z) + _ZBufferParams.y)); } #line 4 mediump float Luminance( in mediump vec3 c ) { #line 6 return dot( c, vec3( 0.22, 0.707, 0.071)); } #line 64 mediump vec4 xlat_main( in v2f i ) { i.ray = (i.ray * (_ProjectionParams.z / i.ray.z)); highp vec2 uv = (i.uv.xy / i.uv.w); #line 68 mediump vec4 nspec = texture( _CameraNormalsTexture, uv); mediump vec3 normal = ((nspec.xyz * 2.0) - 1.0); normal = normalize(normal); highp float depth = texture( _CameraDepthTexture, uv).x; #line 72 depth = Linear01Depth( depth); highp vec4 vpos = vec4( (i.ray * depth), 1.0); highp vec3 wpos = (_CameraToWorld * vpos).xyz; highp vec3 tolight = (wpos - _LightPos.xyz); #line 76 mediump vec3 lightDir = (-normalize(tolight)); highp float att = (dot( tolight, tolight) * _LightPos.w); highp float atten = texture( _LightTextureB0, vec2( att)).w; atten *= ComputeShadow( tolight, vpos.z, uv); #line 80 atten *= texture( _LightTexture0, (_LightMatrix0 * vec4( wpos, 1.0)).xyz).w; mediump float diff = max( 0.0, dot( lightDir, normal)); mediump vec3 h = normalize((lightDir - normalize((wpos - _WorldSpaceCameraPos)))); highp float spec = pow( max( 0.0, dot( h, normal)), (nspec.w * 128.0)); #line 84 spec *= xll_saturate_f(atten); mediump vec4 res; res.xyz = (_LightColor.xyz * (diff * atten)); res.w = (spec * Luminance( _LightColor.xyz)); #line 88 highp float fade = ((vpos.z * unity_LightmapFade.z) + unity_LightmapFade.w); res *= xll_saturate_f((1.0 - fade)); return exp2((-res)); } in highp vec4 xlv_TEXCOORD0; in highp vec3 xlv_TEXCOORD1; void main() { mediump vec4 xl_retval; v2f xlt_i; xlt_i.pos = vec4(0.0); xlt_i.uv = vec4(xlv_TEXCOORD0); xlt_i.ray = vec3(xlv_TEXCOORD1); xl_retval = xlat_main( xlt_i); gl_FragData[0] = vec4(xl_retval); } // uniforms: // _CameraDepthTexture: type 25 arrsize 0 // _CameraNormalsTexture: type 25 arrsize 0 // _CameraToWorld: type 21 arrsize 0 // _LightColor: type 12 arrsize 0 // _LightMatrix0: type 21 arrsize 0 // _LightPos: type 12 arrsize 0 // _LightPositionRange: type 12 arrsize 0 // _LightShadowData: type 12 arrsize 0 // _LightTexture0: type 28 arrsize 0 // _LightTextureB0: type 25 arrsize 0 // _ProjectionParams: type 12 arrsize 0 // _ShadowMapTexture: type 28 arrsize 0 // _WorldSpaceCameraPos: type 11 arrsize 0 // _ZBufferParams: type 12 arrsize 0 // unity_LightmapFade: type 12 arrsize 0