#extension GL_ARB_shader_texture_lod : 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 texture2DLod( s, coord.xy, coord.w); } vec4 xll_texCUBElod(samplerCube s, vec4 coord) { return textureCubeLod( 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 104 struct MySurfaceOutput { vec3 Albedo; vec3 Normal; vec3 Emission; vec3 Specular; float Reflectivity; float Roughness; float Alpha; }; #line 253 struct ContinuousSamplerLOD { float mip0; float mip1; float mipFrac; }; #line 268 struct PlanarMapping { vec4 plane; vec3 tangent; vec3 bitangent; vec2 uvOffset; }; #line 91 struct Input { vec2 uv_MainTex; vec2 uv_BumpMap; vec3 viewDir; vec3 worldPos; vec3 worldNormal; vec3 worldRefl; vec3 TtoW0; vec3 TtoW1; vec3 TtoW2; }; #line 407 struct v2f_surf { vec4 pos; vec4 pack0; vec3 worldPos; vec3 viewDir; vec4 TtoW0; vec4 TtoW1; vec4 TtoW2; vec4 lmap; vec3 lightDir; }; #line 17 struct appdata_full { vec4 vertex; vec4 tangent; vec3 normal; vec4 texcoord; vec4 texcoord1; vec4 color; }; uniform vec3 _WorldSpaceCameraPos; uniform vec4 _WorldSpaceLightPos0; #line 3 uniform vec4 unity_SHAr; uniform vec4 unity_SHAg; uniform vec4 unity_SHAb; uniform vec4 unity_SHBr; #line 7 uniform vec4 unity_SHBg; uniform vec4 unity_SHBb; uniform vec4 unity_SHC; uniform mat4 glstate_matrix_mvp; #line 11 uniform mat4 glstate_matrix_modelview0; uniform mat4 _Object2World; uniform mat4 _World2Object; uniform vec4 unity_Scale; #line 15 uniform mat4 glstate_matrix_projection; uniform vec4 glstate_lightmodel_ambient; #line 27 #line 32 #line 37 #line 41 #line 46 #line 85 uniform vec4 _LightColor0; uniform vec4 _SpecColor; #line 115 uniform float _Rolloff; #line 120 #line 124 uniform float _Falloff; #line 210 uniform float _Roughness; uniform float _Roughness2; #line 218 uniform float _Reflectivity; uniform float _Refl0; uniform float _Refl90; uniform float _Metalic; uniform float _SpecOnlyIntensity; #line 222 uniform float _ReflOnlyIntensity; #line 242 #line 260 #line 264 #line 276 uniform mat4 _WorldToMirrorProjMatrix; uniform sampler2D _MirrorTex; #line 302 uniform vec4 _PlanarReflection0; uniform vec4 _PlanarReflectionTangent0; uniform vec4 _PlanarReflectionBiTangent0; #line 342 uniform sampler2D _PlanarReflectionTex0; uniform vec4 _PlanarReflection1; uniform vec4 _PlanarReflectionTangent1; uniform vec4 _PlanarReflectionBiTangent1; uniform sampler2D _PlanarReflectionTex1; #line 346 uniform vec4 _PlanarReflection2; uniform vec4 _PlanarReflectionTangent2; uniform vec4 _PlanarReflectionBiTangent2; uniform sampler2D _PlanarReflectionTex2; uniform samplerCube _Cube; #line 350 uniform sampler2D _MainTex; uniform sampler2D _BumpMap; uniform sampler2D _BumpMap2; #line 382 uniform sampler2D _MainReflectivityTex; uniform sampler2D _MainRoughnessTex; uniform vec4 _BumpMap2_ST; uniform vec4 _Color; uniform vec4 _ReflColor; #line 386 uniform float _BumpMapFactor; uniform float _BumpMapFactor2; uniform vec4 _MainReflectivityTex_AddMul; uniform vec4 _MainRoughnessTex_AddMul; #line 420 uniform vec4 unity_LightmapST; uniform vec4 unity_ShadowFadeCenterAndType; uniform vec4 _MainTex_ST; uniform vec4 _BumpMap_ST; #line 424 #line 452 uniform sampler2D unity_Lightmap; uniform sampler2D unity_LightmapInd; uniform sampler2D unity_LightmapThird; uniform vec4 unity_LightmapFade; #line 456 #line 64 vec3 DecodeLightmap( in vec4 color ) { #line 66 return ((8.0 * color.w) * color.xyz); } #line 120 float BlinnTermWithRolloff( in vec3 normal, in vec3 halfDir ) { return (max( 0.0, (dot( normal, halfDir) + (_Rolloff * 2.0))) / (1.0 + (_Rolloff * 2.0))); } #line 130 float CTGeometricTerm( in float NdotL, in float NdotH, in float NdotV, in float VdotH ) { #line 132 return min( 1.0, min( (((2.0 * NdotH) * NdotV) / VdotH), (((2.0 * NdotH) * NdotL) / VdotH))); } #line 134 float CTRoughnessTerm( in float roughness, in float NdotH ) { #line 136 float mSq = (roughness * roughness); float a = (1.0 / ((4.0 * mSq) * pow( NdotH, 4.0))); float b = ((NdotH * NdotH) - 1.0); float c = ((mSq * NdotH) * NdotH); #line 140 return (a * exp((b / c))); } #line 125 float FresnelTerm( in float refl0, in float refl90, in float cosA ) { float t = pow( abs((1.0 - cosA)), _Falloff); #line 128 return ((refl0 * (1.0 - t)) + (refl90 * t)); } #line 116 float LambertTermWithRolloff( in vec3 normal, in vec3 lightDir ) { return (max( 0.0, (dot( normal, lightDir) + _Rolloff)) / (1.0 + (_Rolloff * 2.0))); } #line 142 float CookTorranceTerm( in float roughness, in float refl0, in float refl90, in vec3 normal, in vec3 lightDir, in vec3 viewDir ) { #line 144 vec3 halfDir = normalize((lightDir + viewDir)); float nl = LambertTermWithRolloff( normal, lightDir); float nh = BlinnTermWithRolloff( normal, halfDir); float nv = max( 0.0, dot( normal, viewDir)); #line 148 float vh = max( 0.0, dot( viewDir, halfDir)); float F = FresnelTerm( refl0, refl90, vh); float G = CTGeometricTerm( nl, nh, nv, vh); float R = CTRoughnessTerm( roughness, nh); #line 152 R = max( 0.0, R); return max( 0.0, (((F * G) * R) / (nv * nl))); } #line 155 float OrenNayarTerm( in float roughness, in vec3 normal, in vec3 lightDir, in vec3 viewDir ) { #line 157 const float PI = 3.14159; const float INVERSE_PI = 0.3183101; const float INVERSE_PI_SQ = 0.1013213; float rSq = (roughness * roughness); #line 161 float NdotL = LambertTermWithRolloff( normal, lightDir); float NdotV = dot( normal, viewDir); float a = max( acos(NdotV), acos(NdotL)); float b = min( acos(NdotV), acos(NdotL)); #line 165 float y = dot( (viewDir - (normal * NdotV)), (lightDir - (normal * NdotL))); float K1 = (rSq / (rSq + 0.33)); float K2 = (rSq / (rSq + 0.09)); float c1 = (1.0 - (0.5 * K1)); #line 169 float c2 = (0.45 * K2); c2 *= (sin(a) - (( (y >= 0.0) ) ? ( 0.0 ) : ( pow( ((2.0 * b) * 0.3183101), 3.0) ))); float c3 = ((0.125 * K2) * pow( (((4.0 * a) * b) * 0.1013213), 2.0)); float x = ((y * c2) * tan(b)); #line 173 float e = (((1.0 - abs(y)) * c3) * tan(((a + b) / 2.0))); return ((c1 + x) + e); } #line 223 vec4 LightingOrenNayar_CookTorrance( in MySurfaceOutput s, in vec3 lightDir, in vec3 viewDir, in float atten ) { vec3 normal = normalize(s.Normal); #line 226 lightDir = normalize(lightDir); viewDir = normalize(viewDir); float nl = LambertTermWithRolloff( normal, lightDir); float diffRoughness = _Roughness2; #line 230 float specRoughness = max( 0.02, (_Roughness * s.Roughness)); float refl0 = (_Refl0 * _Reflectivity); float refl90 = (_Refl90 * _Reflectivity); float spec = (CookTorranceTerm( specRoughness, refl0, refl90, normal, lightDir, viewDir) * _SpecOnlyIntensity); #line 234 vec3 specColor = ((_LightColor0.xyz * 2.0) * mix( s.Specular, (s.Specular * s.Albedo), vec3( _Metalic))); vec3 diffColor = (_LightColor0.xyz * 2.0); float diffScatter = OrenNayarTerm( diffRoughness, normal, lightDir, viewDir); vec4 c; #line 238 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 242 vec4 LightingOrenNayar_CookTorrance_DualLightmap( in MySurfaceOutput s, in vec4 indirect, in vec4 total, in float blendFactor, in vec3 lightDir, in vec3 viewDir, in float atten ) { vec3 lmInd = (DecodeLightmap( indirect) - (glstate_lightmodel_ambient.xyz * 2.0)); vec3 lmTotal = (DecodeLightmap( total) - (glstate_lightmodel_ambient.xyz * 2.0)); #line 246 vec3 lmTotalBumped = mix( lmInd, lmTotal, vec3( pow( s.Normal.z, 2.0))); vec4 rtLight = LightingOrenNayar_CookTorrance( s, lightDir, viewDir, atten); vec4 c; c.xyz = (((mix( lmInd, lmTotalBumped, vec3( blendFactor)) * s.Albedo) * (1.0 - s.Reflectivity)) + (rtLight.xyz * (1.0 - blendFactor))); #line 250 c.w = (rtLight.w * (1.0 - blendFactor)); return c; } #line 210 vec3 CombineNormals( in vec3 n1, in vec3 n2 ) { vec3 n = normalize(n1); 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 214 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 192 float EvalMipLevel( in vec3 uvw, in float texResolution ) { #line 194 vec3 dxSize = xll_dFdx_vf3(uvw); vec3 dySize = xll_dFdy_vf3(uvw); float fMipLevel; float fMinTexCoordDelta; #line 198 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 202 return fMipLevel; } #line 264 vec4 texCUBEclod( in samplerCube s, in 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 283 vec4 SampleCubeReflection( in samplerCube s, in vec3 rayDir, in ContinuousSamplerLOD level ) { #line 285 return texCUBEclod( s, rayDir, level); } #line 260 vec4 tex2Dclod( in sampler2D s, in 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 278 vec4 SampleMirrorReflection( in vec3 worldPos, in ContinuousSamplerLOD level ) { #line 280 vec4 ppos = (_WorldToMirrorProjMatrix * vec4( worldPos, 1.0)); return tex2Dclod( _MirrorTex, (ppos.xy / ppos.w), level); } #line 287 vec4 SamplePlanarReflection( in sampler2D s, in PlanarMapping p, in vec3 rayStart, in vec3 rayDir, in ContinuousSamplerLOD level ) { #line 289 float Vd = (-dot( p.plane.xyz, rayDir)); if ((Vd < 0.0001)){ return vec4( 0.0, 0.0, 0.0, 0.0); } float Vo = (dot( p.plane.xyz, rayStart) + p.plane.w); float t = (Vo / Vd); #line 293 if ((t < 0.0)){ return vec4( 0.0, 0.0, 0.0, 0.0); } vec3 Pi = (rayStart + (rayDir * t)); vec3 Po = (p.plane.xyz * p.plane.w); vec3 d = (Pi - Po); #line 297 float u = (((dot( d, p.tangent) * 0.5) + 0.5) - (p.uvOffset.x * 0.5)); 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 302 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 vec3 normal, in float Q, in float lod ) { float W = (Q / pow( 2.0, 0.5)); vec3 worldP = IN.worldPos; #line 306 vec4 o1 = vec4( 0.0); vec4 o2 = vec4( 0.0); vec3 worldRefl; worldRefl = reflect( IN.worldRefl, vec3( dot( IN.TtoW0, normal), dot( IN.TtoW1, normal), dot( IN.TtoW2, normal))); #line 310 ContinuousSamplerLOD clod; clod.mip0 = floor(lod); clod.mip1 = (clod.mip0 + 1.0); clod.mipFrac = fract(lod); #line 314 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 318 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 322 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 326 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 330 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 334 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 338 return mix( o2, o1, vec4( o1.w)); } #line 46 vec3 ShadeSH9( in vec4 normal ) { vec3 x1; vec3 x2; vec3 x3; x1.x = dot( unity_SHAr, normal); #line 50 x1.y = dot( unity_SHAg, normal); x1.z = dot( unity_SHAb, normal); 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); float vC = ((normal.x * normal.x) - (normal.y * normal.y)); x3 = (unity_SHC.xyz * vC); #line 58 return ((x1 + x2) + x3); } #line 350 vec3 GlobalIllumination( in Input IN, in MySurfaceOutput s, out vec3 spec ) { vec3 normal = normalize(s.Normal); vec3 worldRefl = normalize(reflect( IN.worldRefl, vec3( dot( IN.TtoW0, normal), dot( IN.TtoW1, normal), dot( IN.TtoW2, normal)))); #line 354 vec3 worldN = vec3( dot( IN.TtoW0, normal), dot( IN.TtoW1, normal), dot( IN.TtoW2, normal)); float roughness = (_Roughness * s.Roughness); float Q = (0.0825 * (1.0 - pow( (1.0 - max( 0.0, (roughness - 0.033))), 2.0))); float LOD = ((1.25 * (1.0 - pow( (1.0 - max( 0.0, roughness)), 2.0))) * 4.0); #line 358 PlanarMapping pm0; pm0.plane = _PlanarReflection0; pm0.tangent = _PlanarReflectionTangent0.xyz; pm0.bitangent = _PlanarReflectionBiTangent0.xyz; #line 362 pm0.uvOffset = vec2( _PlanarReflectionTangent0.w, _PlanarReflectionBiTangent0.w); PlanarMapping pm1; pm1.plane = _PlanarReflection1; pm1.tangent = _PlanarReflectionTangent1.xyz; #line 366 pm1.bitangent = _PlanarReflectionBiTangent1.xyz; pm1.uvOffset = vec2( _PlanarReflectionTangent1.w, _PlanarReflectionBiTangent1.w); PlanarMapping pm2; pm2.plane = _PlanarReflection2; #line 370 pm2.tangent = _PlanarReflectionTangent2.xyz; pm2.bitangent = _PlanarReflectionBiTangent2.xyz; pm2.uvOffset = vec2( _PlanarReflectionTangent2.w, _PlanarReflectionBiTangent2.w); LOD = max( EvalMipLevel( worldRefl, 256.0), LOD); #line 374 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)); vec3 ambient = (ShadeSH9( vec4( worldN, 1.0)) * s.Albedo); #line 378 return mix( ambient, refl, vec3( xll_saturate_f(s.Reflectivity))); } #line 204 float RemapToRange( in float v, in vec4 range ) { #line 206 v *= range.y; v += range.x; return v; } #line 68 vec3 UnpackNormal( in vec4 packednormal ) { #line 70 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 389 void surf( in Input IN, inout MySurfaceOutput o ) { #line 391 vec4 c = texture2D( _MainTex, IN.uv_MainTex); o.Albedo = (c.xyz * _Color.xyz); o.Alpha = c.w; o.Specular = _ReflColor.xyz; #line 395 vec2 uv_BumpMap2 = ((IN.uv_MainTex.xy * _BumpMap2_ST.xy) + _BumpMap2_ST.zw); vec3 up = vec3( 0.0, 0.0, 1.0); vec3 n1 = mix( up, max( vec3( -1.0, -1.0, 0.01), UnpackNormal( texture2D( _BumpMap, IN.uv_BumpMap))), vec3( _BumpMapFactor)); vec3 n2 = mix( up, max( vec3( -1.0, -1.0, 0.01), UnpackNormal( texture2D( _BumpMap2, uv_BumpMap2))), vec3( _BumpMapFactor2)); #line 399 o.Normal = CombineNormals( n1, n2); float NdotV = max( 0.0, dot( o.Normal, normalize(IN.viewDir))); float F = FresnelTerm( (_Refl0 * _Reflectivity), (_Refl90 * _Reflectivity), NdotV); o.Reflectivity = (RemapToRange( texture2D( _MainReflectivityTex, IN.uv_MainTex).x, _MainReflectivityTex_AddMul) * F); #line 403 o.Roughness = RemapToRange( texture2D( _MainRoughnessTex, IN.uv_MainTex).x, _MainRoughnessTex_AddMul); vec3 globalSpec; o.Emission = GlobalIllumination( IN, o, globalSpec); } #line 456 vec4 xlat_main( in v2f_surf IN ) { Input surfIN; surfIN.uv_MainTex = IN.pack0.xy; #line 460 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 464 surfIN.TtoW2 = IN.TtoW2.xyz; surfIN.worldNormal = vec3( 0.0); surfIN.TtoW0 = IN.TtoW0.xyz; surfIN.TtoW1 = IN.TtoW1.xyz; #line 468 surfIN.TtoW2 = IN.TtoW2.xyz; surfIN.worldPos = IN.worldPos; surfIN.viewDir = IN.viewDir; MySurfaceOutput o; #line 472 o.Albedo = vec3( 0.0); o.Emission = vec3( 0.0); o.Specular = vec3( 0.0); o.Alpha = 0.0; #line 476 vec4 lmtex2 = texture2D( unity_LightmapThird, IN.lmap.xy); surf( surfIN, o); float atten = 1.0; vec4 c = vec4( 0.0); #line 480 vec4 lmtex0 = texture2D( unity_LightmapInd, IN.lmap.xy); vec4 lmtex1 = texture2D( unity_Lightmap, IN.lmap.xy); float lmFade = xll_saturate_f(((IN.lmap.z * unity_LightmapFade.z) + unity_LightmapFade.w)); float lmShadow = lmtex2.x; #line 484 vec4 lm = LightingOrenNayar_CookTorrance_DualLightmap( o, lmtex0, lmtex1, lmFade, IN.lightDir, normalize(IN.viewDir), (atten * lmShadow)); c += lm; c.xyz += o.Emission; c.w = 1.0; #line 488 return c; } varying vec4 xlv_TEXCOORD0; varying vec3 xlv_TEXCOORD1; varying vec3 xlv_TEXCOORD2; varying vec4 xlv_TEXCOORD3; varying vec4 xlv_TEXCOORD4; varying vec4 xlv_TEXCOORD5; varying vec4 xlv_TEXCOORD6; varying vec3 xlv_TEXCOORD7; void main() { 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.lmap = vec4(xlv_TEXCOORD6); xlt_IN.lightDir = vec3(xlv_TEXCOORD7); 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 // _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 // glstate_lightmodel_ambient: type 12 arrsize 0 // unity_Lightmap: type 25 arrsize 0 // unity_LightmapFade: type 12 arrsize 0 // unity_LightmapInd: type 25 arrsize 0 // unity_LightmapThird: type 25 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