#extension GL_EXT_shader_texture_lod : require #extension GL_OES_standard_derivatives : require float xll_dFdx_f(float f) { return dFdx(f); } vec2 xll_dFdx_vf2(vec2 v) { return dFdx(v); } vec3 xll_dFdx_vf3(vec3 v) { return dFdx(v); } vec4 xll_dFdx_vf4(vec4 v) { return dFdx(v); } mat2 xll_dFdx_mf2x2(mat2 m) { return mat2( dFdx(m[0]), dFdx(m[1])); } mat3 xll_dFdx_mf3x3(mat3 m) { return mat3( dFdx(m[0]), dFdx(m[1]), dFdx(m[2])); } mat4 xll_dFdx_mf4x4(mat4 m) { return mat4( dFdx(m[0]), dFdx(m[1]), dFdx(m[2]), dFdx(m[3])); } float xll_dFdy_f(float f) { return dFdy(f); } vec2 xll_dFdy_vf2(vec2 v) { return dFdy(v); } vec3 xll_dFdy_vf3(vec3 v) { return dFdy(v); } vec4 xll_dFdy_vf4(vec4 v) { return dFdy(v); } mat2 xll_dFdy_mf2x2(mat2 m) { return mat2( dFdy(m[0]), dFdy(m[1])); } mat3 xll_dFdy_mf3x3(mat3 m) { return mat3( dFdy(m[0]), dFdy(m[1]), dFdy(m[2])); } mat4 xll_dFdy_mf4x4(mat4 m) { return mat4( dFdy(m[0]), dFdy(m[1]), dFdy(m[2]), dFdy(m[3])); } vec4 xll_tex2Dlod(sampler2D s, vec4 coord) { return texture2DLodEXT( s, coord.xy, coord.w); } vec4 xll_texCUBElod(samplerCube s, vec4 coord) { return textureCubeLodEXT( s, coord.xyz, coord.w); } mat2 xll_transpose_mf2x2(mat2 m) { return mat2( m[0][0], m[1][0], m[0][1], m[1][1]); } mat3 xll_transpose_mf3x3(mat3 m) { return mat3( m[0][0], m[1][0], m[2][0], m[0][1], m[1][1], m[2][1], m[0][2], m[1][2], m[2][2]); } mat4 xll_transpose_mf4x4(mat4 m) { return mat4( m[0][0], m[1][0], m[2][0], m[3][0], m[0][1], m[1][1], m[2][1], m[3][1], m[0][2], m[1][2], m[2][2], m[3][2], m[0][3], m[1][3], m[2][3], m[3][3]); } 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_matrixindex_mf2x2_i (mat2 m, int i) { vec2 v; v.x=m[0][i]; v.y=m[1][i]; return v; } vec3 xll_matrixindex_mf3x3_i (mat3 m, int i) { vec3 v; v.x=m[0][i]; v.y=m[1][i]; v.z=m[2][i]; return v; } vec4 xll_matrixindex_mf4x4_i (mat4 m, int i) { vec4 v; v.x=m[0][i]; v.y=m[1][i]; v.z=m[2][i]; v.w=m[3][i]; return v; } #line 106 struct MySurfaceOutput { highp vec3 Albedo; highp vec3 Normal; highp vec3 Emission; highp vec3 Specular; highp float Reflectivity; highp float Roughness; highp float Alpha; }; #line 244 struct ContinuousSamplerLOD { highp float mip0; highp float mip1; highp float mipFrac; }; #line 259 struct PlanarMapping { highp vec4 plane; highp vec3 tangent; highp vec3 bitangent; highp vec2 uvOffset; }; #line 93 struct Input { highp vec2 uv_MainTex; highp vec2 uv_BumpMap; highp vec3 viewDir; highp vec3 worldPos; highp vec3 worldNormal; highp vec3 worldRefl; mediump vec3 TtoW0; mediump vec3 TtoW1; mediump vec3 TtoW2; }; #line 398 struct v2f_surf { highp vec4 pos; highp vec4 pack0; highp vec3 worldPos; highp vec3 viewDir; lowp vec4 TtoW0; lowp vec4 TtoW1; lowp vec4 TtoW2; lowp vec3 lightDir; lowp vec3 vlight; highp vec2 _LightCoord; }; #line 17 struct appdata_full { highp vec4 vertex; highp vec4 tangent; highp vec3 normal; highp vec4 texcoord; highp vec4 texcoord1; lowp vec4 color; }; uniform highp vec3 _WorldSpaceCameraPos; uniform lowp vec4 _WorldSpaceLightPos0; #line 3 uniform highp vec4 unity_SHAr; uniform highp vec4 unity_SHAg; uniform highp vec4 unity_SHAb; uniform highp vec4 unity_SHBr; #line 7 uniform highp vec4 unity_SHBg; uniform highp vec4 unity_SHBb; uniform highp vec4 unity_SHC; uniform highp mat4 glstate_matrix_mvp; #line 11 uniform highp mat4 glstate_matrix_modelview0; uniform highp mat4 _Object2World; uniform highp mat4 _World2Object; uniform highp vec4 unity_Scale; #line 15 uniform highp mat4 glstate_matrix_projection; uniform highp vec4 glstate_lightmodel_ambient; #line 27 #line 32 #line 37 #line 41 #line 46 #line 85 uniform lowp vec4 _LightColor0; uniform lowp vec4 _SpecColor; uniform sampler2D _LightTexture0; uniform highp mat4 _LightMatrix0; #line 117 uniform highp float _Rolloff; #line 122 #line 126 uniform highp float _Falloff; #line 212 uniform highp float _Roughness; uniform highp float _Roughness2; #line 220 uniform highp float _Reflectivity; uniform highp float _Refl0; uniform highp float _Refl90; uniform highp float _Metalic; uniform highp float _SpecOnlyIntensity; #line 224 uniform highp float _ReflOnlyIntensity; #line 251 #line 255 #line 267 uniform highp mat4 _WorldToMirrorProjMatrix; uniform sampler2D _MirrorTex; #line 293 uniform highp vec4 _PlanarReflection0; uniform highp vec4 _PlanarReflectionTangent0; uniform highp vec4 _PlanarReflectionBiTangent0; #line 333 uniform sampler2D _PlanarReflectionTex0; uniform highp vec4 _PlanarReflection1; uniform highp vec4 _PlanarReflectionTangent1; uniform highp vec4 _PlanarReflectionBiTangent1; uniform sampler2D _PlanarReflectionTex1; #line 337 uniform highp vec4 _PlanarReflection2; uniform highp vec4 _PlanarReflectionTangent2; uniform highp vec4 _PlanarReflectionBiTangent2; uniform sampler2D _PlanarReflectionTex2; uniform samplerCube _Cube; #line 341 uniform sampler2D _MainTex; uniform sampler2D _BumpMap; uniform sampler2D _BumpMap2; #line 373 uniform sampler2D _MainReflectivityTex; uniform sampler2D _MainRoughnessTex; uniform highp vec4 _BumpMap2_ST; uniform lowp vec4 _Color; uniform lowp vec4 _ReflColor; #line 377 uniform highp float _BumpMapFactor; uniform highp float _BumpMapFactor2; uniform highp vec4 _MainReflectivityTex_AddMul; uniform highp vec4 _MainRoughnessTex_AddMul; #line 412 uniform highp vec4 _MainTex_ST; uniform highp vec4 _BumpMap_ST; #line 440 #line 122 highp float BlinnTermWithRolloff( in highp vec3 normal, in highp vec3 halfDir ) { return (max( 0.0, (dot( normal, halfDir) + (_Rolloff * 2.0))) / (1.0 + (_Rolloff * 2.0))); } #line 132 highp float CTGeometricTerm( in highp float NdotL, in highp float NdotH, in highp float NdotV, in highp float VdotH ) { #line 134 return min( 1.0, min( (((2.0 * NdotH) * NdotV) / VdotH), (((2.0 * NdotH) * NdotL) / VdotH))); } #line 136 highp float CTRoughnessTerm( in highp float roughness, in highp float NdotH ) { #line 138 highp float mSq = (roughness * roughness); highp float a = (1.0 / ((4.0 * mSq) * pow( NdotH, 4.0))); highp float b = ((NdotH * NdotH) - 1.0); highp float c = ((mSq * NdotH) * NdotH); #line 142 return (a * exp((b / c))); } #line 127 highp float FresnelTerm( in highp float refl0, in highp float refl90, in highp float cosA ) { highp float t = pow( abs((1.0 - cosA)), _Falloff); #line 130 return ((refl0 * (1.0 - t)) + (refl90 * t)); } #line 118 highp float LambertTermWithRolloff( in highp vec3 normal, in highp vec3 lightDir ) { return (max( 0.0, (dot( normal, lightDir) + _Rolloff)) / (1.0 + (_Rolloff * 2.0))); } #line 144 highp float CookTorranceTerm( in highp float roughness, in highp float refl0, in highp float refl90, in highp vec3 normal, in highp vec3 lightDir, in highp vec3 viewDir ) { #line 146 highp vec3 halfDir = normalize((lightDir + viewDir)); highp float nl = LambertTermWithRolloff( normal, lightDir); highp float nh = BlinnTermWithRolloff( normal, halfDir); highp float nv = max( 0.0, dot( normal, viewDir)); #line 150 highp float vh = max( 0.0, dot( viewDir, halfDir)); highp float F = FresnelTerm( refl0, refl90, vh); highp float G = CTGeometricTerm( nl, nh, nv, vh); highp float R = CTRoughnessTerm( roughness, nh); #line 154 R = max( 0.0, R); return max( 0.0, (((F * G) * R) / (nv * nl))); } #line 157 highp float OrenNayarTerm( in highp float roughness, in highp vec3 normal, in highp vec3 lightDir, in highp vec3 viewDir ) { #line 159 const highp float PI = 3.14159; const highp float INVERSE_PI = 0.3183101; const highp float INVERSE_PI_SQ = 0.1013213; highp float rSq = (roughness * roughness); #line 163 highp float NdotL = LambertTermWithRolloff( normal, lightDir); highp float NdotV = dot( normal, viewDir); highp float a = max( acos(NdotV), acos(NdotL)); highp float b = min( acos(NdotV), acos(NdotL)); #line 167 highp float y = dot( (viewDir - (normal * NdotV)), (lightDir - (normal * NdotL))); highp float K1 = (rSq / (rSq + 0.33)); highp float K2 = (rSq / (rSq + 0.09)); highp float c1 = (1.0 - (0.5 * K1)); #line 171 highp float c2 = (0.45 * K2); c2 *= (sin(a) - (( (y >= 0.0) ) ? ( 0.0 ) : ( pow( ((2.0 * b) * 0.3183101), 3.0) ))); highp float c3 = ((0.125 * K2) * pow( (((4.0 * a) * b) * 0.1013213), 2.0)); highp float x = ((y * c2) * tan(b)); #line 175 highp float e = (((1.0 - abs(y)) * c3) * tan(((a + b) / 2.0))); return ((c1 + x) + e); } #line 225 lowp vec4 LightingOrenNayar_CookTorrance( in MySurfaceOutput s, in highp vec3 lightDir, in highp vec3 viewDir, in highp float atten ) { highp vec3 normal = normalize(s.Normal); #line 228 lightDir = normalize(lightDir); viewDir = normalize(viewDir); highp float nl = LambertTermWithRolloff( normal, lightDir); highp float diffRoughness = _Roughness2; #line 232 highp float specRoughness = max( 0.02, (_Roughness * s.Roughness)); highp float refl0 = (_Refl0 * _Reflectivity); highp float refl90 = (_Refl90 * _Reflectivity); highp float spec = (CookTorranceTerm( specRoughness, refl0, refl90, normal, lightDir, viewDir) * _SpecOnlyIntensity); #line 236 highp vec3 specColor = ((_LightColor0.xyz * 2.0) * mix( s.Specular, (s.Specular * s.Albedo), vec3( _Metalic))); highp vec3 diffColor = (_LightColor0.xyz * 2.0); highp float diffScatter = OrenNayarTerm( diffRoughness, normal, lightDir, viewDir); lowp vec4 c; #line 240 c.xyz = ((mix( ((s.Albedo * diffColor) * diffScatter), (specColor * spec), vec3( s.Reflectivity)) * nl) * atten); c.w = (s.Alpha + ((((length(specColor) * spec) * s.Reflectivity) * nl) * atten)); return c; } #line 212 highp vec3 CombineNormals( in highp vec3 n1, in highp vec3 n2 ) { highp vec3 n = normalize(n1); highp mat3 nBasis = xll_transpose_mf3x3(mat3( vec3( n.z, n.x, (-n.y)), vec3( n.x, n.z, (-n.y)), vec3( n.x, n.y, n.z))); #line 216 return normalize((((n2.x * xll_matrixindex_mf3x3_i (nBasis, 0)) + (n2.y * xll_matrixindex_mf3x3_i (nBasis, 1))) + (n2.z * xll_matrixindex_mf3x3_i (nBasis, 2)))); } #line 194 highp float EvalMipLevel( in highp vec3 uvw, in highp float texResolution ) { #line 196 highp vec3 dxSize = xll_dFdx_vf3(uvw); highp vec3 dySize = xll_dFdy_vf3(uvw); highp float fMipLevel; highp float fMinTexCoordDelta; #line 200 highp vec3 dTexCoords; dTexCoords = ((dxSize * dxSize) + (dySize * dySize)); fMinTexCoordDelta = (max( dTexCoords.z, max( dTexCoords.x, dTexCoords.y)) * texResolution); fMipLevel = max( (0.5 * log2(fMinTexCoordDelta)), 0.0); #line 204 return fMipLevel; } #line 255 highp vec4 texCUBEclod( in samplerCube s, in highp vec3 dir, in ContinuousSamplerLOD level ) { return mix( xll_texCUBElod( s, vec4( dir, level.mip0)), xll_texCUBElod( s, vec4( dir, level.mip1)), vec4( level.mipFrac)); } #line 274 highp vec4 SampleCubeReflection( in samplerCube s, in highp vec3 rayDir, in ContinuousSamplerLOD level ) { #line 276 return texCUBEclod( s, rayDir, level); } #line 251 highp vec4 tex2Dclod( in sampler2D s, in highp vec2 uv, in ContinuousSamplerLOD level ) { return mix( xll_tex2Dlod( s, vec4( uv, 0.0, level.mip0)), xll_tex2Dlod( s, vec4( uv, 0.0, level.mip1)), vec4( level.mipFrac)); } #line 269 highp vec4 SampleMirrorReflection( in highp vec3 worldPos, in ContinuousSamplerLOD level ) { #line 271 highp vec4 ppos = (_WorldToMirrorProjMatrix * vec4( worldPos, 1.0)); return tex2Dclod( _MirrorTex, (ppos.xy / ppos.w), level); } #line 278 highp vec4 SamplePlanarReflection( in sampler2D s, in PlanarMapping p, in highp vec3 rayStart, in highp vec3 rayDir, in ContinuousSamplerLOD level ) { #line 280 highp float Vd = (-dot( p.plane.xyz, rayDir)); if ((Vd < 0.0001)){ return vec4( 0.0, 0.0, 0.0, 0.0); } highp float Vo = (dot( p.plane.xyz, rayStart) + p.plane.w); highp float t = (Vo / Vd); #line 284 if ((t < 0.0)){ return vec4( 0.0, 0.0, 0.0, 0.0); } highp vec3 Pi = (rayStart + (rayDir * t)); highp vec3 Po = (p.plane.xyz * p.plane.w); highp vec3 d = (Pi - Po); #line 288 highp float u = (((dot( d, p.tangent) * 0.5) + 0.5) - (p.uvOffset.x * 0.5)); highp float v = (((dot( d, (-p.bitangent)) * 0.5) + 0.5) + (p.uvOffset.y * 0.5)); if (((((u < 0.0) || (u > 1.0)) || (v < 0.0)) || (v > 1.0))){ return vec4( 0.0, 0.0, 0.0, 0.0); } return tex2Dclod( s, vec2( u, v), level); } #line 293 highp vec4 GlossyReflectionTerm( in Input IN, in samplerCube crefl, in PlanarMapping pm0, in sampler2D prefl0, in PlanarMapping pm1, in sampler2D prefl1, in PlanarMapping pm2, in sampler2D prefl2, in highp vec3 normal, in highp float Q, in highp float lod ) { highp float W = (Q / pow( 2.0, 0.5)); highp vec3 worldP = IN.worldPos; #line 297 highp vec4 o1 = vec4( 0.0); highp vec4 o2 = vec4( 0.0); highp vec3 worldRefl; worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, normal), dot( IN.TtoW1, normal), dot( IN.TtoW2, normal))); #line 301 ContinuousSamplerLOD clod; clod.mip0 = floor(lod); clod.mip1 = (clod.mip0 + 1.0); clod.mipFrac = fract(lod); #line 305 o1 = SampleMirrorReflection( worldP, clod); o1 = mix( SamplePlanarReflection( prefl0, pm0, worldP, worldRefl, clod), o1, vec4( o1.w)); o1 = mix( SamplePlanarReflection( prefl1, pm1, worldP, worldRefl, clod), o1, vec4( o1.w)); o1 = mix( SamplePlanarReflection( prefl2, pm2, worldP, worldRefl, clod), o1, vec4( o1.w)); #line 309 clod.mip0 = floor((lod * 2.0)); clod.mip1 = (clod.mip0 + 1.0); clod.mipFrac = fract((lod * 2.0)); worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, (normal + vec3( Q, 0.0, 0.0))), dot( IN.TtoW1, (normal + vec3( Q, 0.0, 0.0))), dot( IN.TtoW2, (normal + vec3( Q, 0.0, 0.0))))); #line 313 o2 += SampleCubeReflection( crefl, worldRefl, clod); worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, (normal + vec3( (-Q), 0.0, 0.0))), dot( IN.TtoW1, (normal + vec3( (-Q), 0.0, 0.0))), dot( IN.TtoW2, (normal + vec3( (-Q), 0.0, 0.0))))); o2 += SampleCubeReflection( crefl, worldRefl, clod); worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, (normal + vec3( 0.0, (-Q), 0.0))), dot( IN.TtoW1, (normal + vec3( 0.0, (-Q), 0.0))), dot( IN.TtoW2, (normal + vec3( 0.0, (-Q), 0.0))))); #line 317 o2 += SampleCubeReflection( crefl, worldRefl, clod); worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, (normal + vec3( 0.0, Q, 0.0))), dot( IN.TtoW1, (normal + vec3( 0.0, Q, 0.0))), dot( IN.TtoW2, (normal + vec3( 0.0, Q, 0.0))))); o2 += SampleCubeReflection( crefl, worldRefl, clod); worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, (normal + vec3( W, W, 0.0))), dot( IN.TtoW1, (normal + vec3( W, W, 0.0))), dot( IN.TtoW2, (normal + vec3( W, W, 0.0))))); #line 321 o2 += SampleCubeReflection( crefl, worldRefl, clod); worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, (normal + vec3( (-W), W, 0.0))), dot( IN.TtoW1, (normal + vec3( (-W), W, 0.0))), dot( IN.TtoW2, (normal + vec3( (-W), W, 0.0))))); o2 += SampleCubeReflection( crefl, worldRefl, clod); worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, (normal + vec3( W, (-W), 0.0))), dot( IN.TtoW1, (normal + vec3( W, (-W), 0.0))), dot( IN.TtoW2, (normal + vec3( W, (-W), 0.0))))); #line 325 o2 += SampleCubeReflection( crefl, worldRefl, clod); worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, (normal + vec3( (-W), (-W), 0.0))), dot( IN.TtoW1, (normal + vec3( (-W), (-W), 0.0))), dot( IN.TtoW2, (normal + vec3( (-W), (-W), 0.0))))); o2 += SampleCubeReflection( crefl, worldRefl, clod); o2 /= 8.0; #line 329 return mix( o2, o1, vec4( o1.w)); } #line 46 mediump vec3 ShadeSH9( in mediump vec4 normal ) { mediump vec3 x1; mediump vec3 x2; mediump vec3 x3; x1.x = dot( unity_SHAr, normal); #line 50 x1.y = dot( unity_SHAg, normal); x1.z = dot( unity_SHAb, normal); mediump vec4 vB = (normal.xyzz * normal.yzzx); x2.x = dot( unity_SHBr, vB); #line 54 x2.y = dot( unity_SHBg, vB); x2.z = dot( unity_SHBb, vB); highp float vC = ((normal.x * normal.x) - (normal.y * normal.y)); x3 = (unity_SHC.xyz * vC); #line 58 return ((x1 + x2) + x3); } #line 341 highp vec3 GlobalIllumination( in Input IN, in MySurfaceOutput s, out highp vec3 spec ) { highp vec3 normal = normalize(s.Normal); highp vec3 worldRefl = normalize(reflect( IN.worldRefl, vec3( dot( IN.TtoW0, normal), dot( IN.TtoW1, normal), dot( IN.TtoW2, normal)))); #line 345 lowp vec3 worldN = vec3( dot( IN.TtoW0, normal), dot( IN.TtoW1, normal), dot( IN.TtoW2, normal)); highp float roughness = (_Roughness * s.Roughness); highp float Q = (0.0825 * (1.0 - pow( (1.0 - max( 0.0, (roughness - 0.033))), 2.0))); highp float LOD = ((1.25 * (1.0 - pow( (1.0 - max( 0.0, roughness)), 2.0))) * 4.0); #line 349 PlanarMapping pm0; pm0.plane = _PlanarReflection0; pm0.tangent = _PlanarReflectionTangent0.xyz; pm0.bitangent = _PlanarReflectionBiTangent0.xyz; #line 353 pm0.uvOffset = vec2( _PlanarReflectionTangent0.w, _PlanarReflectionBiTangent0.w); PlanarMapping pm1; pm1.plane = _PlanarReflection1; pm1.tangent = _PlanarReflectionTangent1.xyz; #line 357 pm1.bitangent = _PlanarReflectionBiTangent1.xyz; pm1.uvOffset = vec2( _PlanarReflectionTangent1.w, _PlanarReflectionBiTangent1.w); PlanarMapping pm2; pm2.plane = _PlanarReflection2; #line 361 pm2.tangent = _PlanarReflectionTangent2.xyz; pm2.bitangent = _PlanarReflectionBiTangent2.xyz; pm2.uvOffset = vec2( _PlanarReflectionTangent2.w, _PlanarReflectionBiTangent2.w); LOD = max( EvalMipLevel( worldRefl, 256.0), LOD); #line 365 highp vec3 refl = (GlossyReflectionTerm( IN, _Cube, pm0, _PlanarReflectionTex0, pm1, _PlanarReflectionTex1, pm2, _PlanarReflectionTex2, normal, Q, LOD).xyz * _ReflOnlyIntensity); refl *= mix( s.Specular, (s.Specular * s.Albedo), vec3( _Metalic)); spec = (refl * xll_saturate_f(s.Reflectivity)); highp vec3 ambient = (ShadeSH9( vec4( worldN, 1.0)) * s.Albedo); #line 369 return mix( ambient, refl, vec3( xll_saturate_f(s.Reflectivity))); } #line 206 highp float RemapToRange( in highp float v, in highp vec4 range ) { #line 208 v *= range.y; v += range.x; return v; } #line 68 lowp vec3 UnpackNormal( in lowp vec4 packednormal ) { #line 70 lowp vec3 normal; normal.xy = ((packednormal.wy * 2.0) - 1.0); normal.z = sqrt(((1.0 - (normal.x * normal.x)) - (normal.y * normal.y))); return normal; } #line 380 void surf( in Input IN, inout MySurfaceOutput o ) { #line 382 mediump vec4 c = texture2D( _MainTex, IN.uv_MainTex); o.Albedo = (c.xyz * _Color.xyz); o.Alpha = c.w; o.Specular = _ReflColor.xyz; #line 386 highp vec2 uv_BumpMap2 = ((IN.uv_MainTex.xy * _BumpMap2_ST.xy) + _BumpMap2_ST.zw); highp vec3 up = vec3( 0.0, 0.0, 1.0); highp vec3 n1 = mix( up, max( vec3( -1.0, -1.0, 0.01), UnpackNormal( texture2D( _BumpMap, IN.uv_BumpMap))), vec3( _BumpMapFactor)); highp vec3 n2 = mix( up, max( vec3( -1.0, -1.0, 0.01), UnpackNormal( texture2D( _BumpMap2, uv_BumpMap2))), vec3( _BumpMapFactor2)); #line 390 o.Normal = CombineNormals( n1, n2); highp float NdotV = max( 0.0, dot( o.Normal, normalize(IN.viewDir))); highp float F = FresnelTerm( (_Refl0 * _Reflectivity), (_Refl90 * _Reflectivity), NdotV); o.Reflectivity = (RemapToRange( texture2D( _MainReflectivityTex, IN.uv_MainTex).x, _MainReflectivityTex_AddMul) * F); #line 394 o.Roughness = RemapToRange( texture2D( _MainRoughnessTex, IN.uv_MainTex).x, _MainRoughnessTex_AddMul); highp vec3 globalSpec; o.Emission = GlobalIllumination( IN, o, globalSpec); } #line 440 lowp vec4 xlat_main( in v2f_surf IN ) { Input surfIN; surfIN.uv_MainTex = IN.pack0.xy; #line 444 surfIN.uv_BumpMap = IN.pack0.zw; surfIN.worldRefl = vec3( IN.TtoW0.w, IN.TtoW1.w, IN.TtoW2.w); surfIN.TtoW0 = IN.TtoW0.xyz; surfIN.TtoW1 = IN.TtoW1.xyz; #line 448 surfIN.TtoW2 = IN.TtoW2.xyz; surfIN.worldNormal = vec3( 0.0); surfIN.TtoW0 = IN.TtoW0.xyz; surfIN.TtoW1 = IN.TtoW1.xyz; #line 452 surfIN.TtoW2 = IN.TtoW2.xyz; surfIN.worldPos = IN.worldPos; surfIN.viewDir = IN.viewDir; MySurfaceOutput o; #line 456 o.Albedo = vec3( 0.0); o.Emission = vec3( 0.0); o.Specular = vec3( 0.0); o.Alpha = 0.0; #line 460 surf( surfIN, o); lowp float atten = (texture2D( _LightTexture0, IN._LightCoord).w * 1.0); lowp vec4 c = vec4( 0.0); c = LightingOrenNayar_CookTorrance( o, IN.lightDir, normalize(IN.viewDir), atten); #line 464 c.xyz += (o.Albedo * IN.vlight); c.xyz += o.Emission; c.w = 1.0; return c; } varying highp vec4 xlv_TEXCOORD0; varying highp vec3 xlv_TEXCOORD1; varying highp vec3 xlv_TEXCOORD2; varying lowp vec4 xlv_TEXCOORD3; varying lowp vec4 xlv_TEXCOORD4; varying lowp vec4 xlv_TEXCOORD5; varying lowp vec3 xlv_TEXCOORD6; varying lowp vec3 xlv_TEXCOORD7; varying highp vec2 xlv_TEXCOORD8; void main() { lowp vec4 xl_retval; v2f_surf xlt_IN; xlt_IN.pos = vec4(0.0); xlt_IN.pack0 = vec4(xlv_TEXCOORD0); xlt_IN.worldPos = vec3(xlv_TEXCOORD1); xlt_IN.viewDir = vec3(xlv_TEXCOORD2); xlt_IN.TtoW0 = vec4(xlv_TEXCOORD3); xlt_IN.TtoW1 = vec4(xlv_TEXCOORD4); xlt_IN.TtoW2 = vec4(xlv_TEXCOORD5); xlt_IN.lightDir = vec3(xlv_TEXCOORD6); xlt_IN.vlight = vec3(xlv_TEXCOORD7); xlt_IN._LightCoord = vec2(xlv_TEXCOORD8); xl_retval = xlat_main( xlt_IN); gl_FragData[0] = vec4(xl_retval); } // uniforms: // _BumpMap: type 25 arrsize 0 // _BumpMap2: type 25 arrsize 0 // _BumpMap2_ST: type 12 arrsize 0 // _BumpMapFactor: type 9 arrsize 0 // _BumpMapFactor2: type 9 arrsize 0 // _Color: type 12 arrsize 0 // _Cube: type 28 arrsize 0 // _Falloff: type 9 arrsize 0 // _LightColor0: type 12 arrsize 0 // _LightTexture0: type 25 arrsize 0 // _MainReflectivityTex: type 25 arrsize 0 // _MainReflectivityTex_AddMul: type 12 arrsize 0 // _MainRoughnessTex: type 25 arrsize 0 // _MainRoughnessTex_AddMul: type 12 arrsize 0 // _MainTex: type 25 arrsize 0 // _Metalic: type 9 arrsize 0 // _MirrorTex: type 25 arrsize 0 // _PlanarReflection0: type 12 arrsize 0 // _PlanarReflection1: type 12 arrsize 0 // _PlanarReflection2: type 12 arrsize 0 // _PlanarReflectionBiTangent0: type 12 arrsize 0 // _PlanarReflectionBiTangent1: type 12 arrsize 0 // _PlanarReflectionBiTangent2: type 12 arrsize 0 // _PlanarReflectionTangent0: type 12 arrsize 0 // _PlanarReflectionTangent1: type 12 arrsize 0 // _PlanarReflectionTangent2: type 12 arrsize 0 // _PlanarReflectionTex0: type 25 arrsize 0 // _PlanarReflectionTex1: type 25 arrsize 0 // _PlanarReflectionTex2: type 25 arrsize 0 // _Refl0: type 9 arrsize 0 // _Refl90: type 9 arrsize 0 // _ReflColor: type 12 arrsize 0 // _ReflOnlyIntensity: type 9 arrsize 0 // _Reflectivity: type 9 arrsize 0 // _Rolloff: type 9 arrsize 0 // _Roughness: type 9 arrsize 0 // _Roughness2: type 9 arrsize 0 // _SpecOnlyIntensity: type 9 arrsize 0 // _WorldToMirrorProjMatrix: type 21 arrsize 0 // unity_SHAb: type 12 arrsize 0 // unity_SHAg: type 12 arrsize 0 // unity_SHAr: type 12 arrsize 0 // unity_SHBb: type 12 arrsize 0 // unity_SHBg: type 12 arrsize 0 // unity_SHBr: type 12 arrsize 0 // unity_SHC: type 12 arrsize 0