bgfx/3rdparty/glsl-optimizer/tests/fragment/z-unishader-dirlm-ir.txt

895 lines
21 KiB
Text
Raw Normal View History

2014-02-11 02:06:13 -05:00
#extension GL_ARB_shader_texture_lod : enable
struct VertexOutput {
vec4 pos;
vec4 tex;
vec4 posWorld;
vec3 normalWorld;
vec4 tangentWorld;
vec3 extra;
vec4 _ShadowCoord;
vec3 lightDir;
};
uniform vec3 _WorldSpaceCameraPos;
uniform vec4 _ProjectionParams;
uniform vec4 _ScreenParams;
uniform vec4 _ZBufferParams;
uniform vec4 _WorldSpaceLightPos0;
uniform vec4 unity_SHAr;
uniform vec4 unity_SHAg;
uniform vec4 unity_SHAb;
uniform vec4 unity_SHBr;
uniform vec4 unity_SHBg;
uniform vec4 unity_SHBb;
uniform vec4 unity_SHC;
uniform vec4 _LightShadowData;
uniform mat4 _Object2World;
uniform mat4 _World2Object;
uniform vec4 unity_Scale;
uniform mat4 glstate_matrix_transpose_modelview0;
uniform mat4 unity_MatrixV;
uniform mat4 unity_MatrixVP;
uniform samplerCube _Cube;
uniform sampler2D _MainTex;
uniform vec4 _MainTex_ST;
uniform sampler2D _DetailAlbedoMap;
uniform vec4 _DetailAlbedoMap_ST;
uniform sampler2D _AlphaMap;
uniform sampler2D _Occlusion;
uniform sampler2D _DetailNormalMap;
uniform vec4 _DetailNormalMap_ST;
uniform float _DetailNormalMapScale;
uniform sampler2D _BumpMap;
uniform float _BumpScale;
uniform float _Exposure;
uniform float _DetailBumpScale;
uniform float _AlphaTestRef;
uniform float _DetailBumpTiling;
uniform vec4 _Color;
uniform vec4 _SpecularColor;
uniform sampler2D _SpecGlossMap;
uniform float _Glossiness;
uniform vec4 unity_ColorSpaceGrey;
uniform sampler2D _ShadowMapTexture;
uniform vec4 _LightColor0;
uniform samplerCube _SpecCube;
uniform vec4 unity_LightmapST;
uniform sampler2D unity_Lightmap;
uniform sampler2D unity_LightmapInd;
uniform float _SelfIllumScale;
uniform sampler2D _SelfIllum;
varying vec4 xlv_TEXCOORD0;
varying vec4 xlv_TEXCOORD1;
varying vec3 xlv_TEXCOORD2;
varying vec4 xlv_TEXCOORD3;
varying vec3 xlv_TEXCOORD4;
varying vec4 xlv_TEXCOORD5;
varying vec3 xlv_TEXCOORD7;
vec4 xll_texCUBElod (
in samplerCube s_1,
in vec4 coord_2
)
{
vec4 tmpvar_3;
tmpvar_3 = textureCubeLod (s_1, coord_2.xyz, coord_2.w);
return tmpvar_3;
}
mat3 xll_transpose_mf3x3 (
in mat3 m_4
)
{
mat3 tmpvar_5;
float tmpvar_6;
tmpvar_6 = m_4[0][0];
tmpvar_5[0].x = tmpvar_6;
float tmpvar_7;
tmpvar_7 = m_4[1][0];
tmpvar_5[0].y = tmpvar_7;
float tmpvar_8;
tmpvar_8 = m_4[2][0];
tmpvar_5[0].z = tmpvar_8;
float tmpvar_9;
tmpvar_9 = m_4[0][1];
tmpvar_5[1].x = tmpvar_9;
float tmpvar_10;
tmpvar_10 = m_4[1][1];
tmpvar_5[1].y = tmpvar_10;
float tmpvar_11;
tmpvar_11 = m_4[2][1];
tmpvar_5[1].z = tmpvar_11;
float tmpvar_12;
tmpvar_12 = m_4[0][2];
tmpvar_5[2].x = tmpvar_12;
float tmpvar_13;
tmpvar_13 = m_4[1][2];
tmpvar_5[2].y = tmpvar_13;
float tmpvar_14;
tmpvar_14 = m_4[2][2];
tmpvar_5[2].z = tmpvar_14;
return tmpvar_5;
}
float xll_saturate_f (
in float x_15
)
{
float tmpvar_16;
tmpvar_16 = clamp (x_15, 0.0, 1.0);
return tmpvar_16;
}
vec3 xll_saturate_vf3 (
in vec3 x_17
)
{
vec3 tmpvar_18;
tmpvar_18 = clamp (x_17, 0.0, 1.0);
return tmpvar_18;
}
vec3 xll_matrixindex_mf3x3_i (
in mat3 m_19,
in int i_20
)
{
vec3 v_21;
float tmpvar_22;
tmpvar_22 = m_19[0][i_20];
v_21.x = tmpvar_22;
float tmpvar_23;
tmpvar_23 = m_19[1][i_20];
v_21.y = vec2(tmpvar_23).y;
float tmpvar_24;
tmpvar_24 = m_19[2][i_20];
v_21.z = vec3(tmpvar_24).z;
return v_21;
}
vec3 Albedo (
in vec4 texcoords_25
)
{
vec3 albedo_26;
vec4 tmpvar_27;
tmpvar_27 = texture2D (_MainTex, texcoords_25.xy);
vec3 tmpvar_28;
tmpvar_28 = (_Color.xyz * tmpvar_27.xyz);
albedo_26 = tmpvar_28;
vec4 tmpvar_29;
tmpvar_29 = texture2D (_DetailAlbedoMap, texcoords_25.zw);
vec3 tmpvar_30;
tmpvar_30 = (albedo_26 * (2.0 * tmpvar_29.xyz));
albedo_26 = tmpvar_30;
return albedo_26;
}
float Alpha (
in vec2 uv_31
)
{
vec4 tmpvar_32;
tmpvar_32 = texture2D (_AlphaMap, uv_31);
return (tmpvar_32.w * _Color.w);
}
float BlinnPhongTerm (
in float roughness_33,
in float NdotH_34
)
{
float specTerm_35;
float normTerm_36;
float n_37;
float m_38;
float tmpvar_39;
tmpvar_39 = pow (roughness_33, 4.0);
float tmpvar_40;
tmpvar_40 = (tmpvar_39 + 1e-05);
m_38 = tmpvar_40;
float tmpvar_41;
tmpvar_41 = ((1.0 / m_38) - 2.0);
n_37 = tmpvar_41;
float tmpvar_42;
tmpvar_42 = ((n_37 + 1.0) / 6.28318);
normTerm_36 = tmpvar_42;
float tmpvar_43;
tmpvar_43 = pow (NdotH_34, n_37);
float tmpvar_44;
tmpvar_44 = tmpvar_43;
specTerm_35 = tmpvar_44;
return (specTerm_35 * normTerm_36);
}
float BlinnTerm (
in vec3 normal_45,
in vec3 halfDir_46
)
{
float tmpvar_47;
tmpvar_47 = dot (normal_45, halfDir_46);
float tmpvar_48;
tmpvar_48 = max (0.0, tmpvar_47);
return tmpvar_48;
}
float FresnelTerm (
in float F0_49,
in float cosA_50
)
{
float t_51;
float _Falloff_52;
float tmpvar_53;
tmpvar_53 = 5.0;
_Falloff_52 = tmpvar_53;
float tmpvar_54;
tmpvar_54 = abs ((1.0 - cosA_50));
float tmpvar_55;
tmpvar_55 = pow (tmpvar_54, _Falloff_52);
float tmpvar_56;
tmpvar_56 = tmpvar_55;
t_51 = tmpvar_56;
return (F0_49 + ((1.0 - F0_49) * t_51));
}
float CTGeometricTerm (
in float NdotL_57,
in float NdotH_58,
in float NdotV_59,
in float VdotH_60
)
{
float tmpvar_61;
tmpvar_61 = (VdotH_60 + 1e-05);
VdotH_60 = tmpvar_61;
float tmpvar_62;
tmpvar_62 = min ((((2.0 * NdotH_58) * NdotV_59) / VdotH_60), (((2.0 * NdotH_58) * NdotL_57) / VdotH_60));
float tmpvar_63;
tmpvar_63 = min (1.0, tmpvar_62);
return tmpvar_63;
}
float GeometricTerm (
in float NdotL_64,
in float NdotH_65,
in float NdotV_66,
in float VdotH_67,
in float LdotV_68
)
{
float tmpvar_69;
tmpvar_69 = CTGeometricTerm (NdotL_64, NdotH_65, NdotV_66, VdotH_67);
return tmpvar_69;
}
float LambertTerm (
in vec3 normal_70,
in vec3 lightDir_71
)
{
float tmpvar_72;
tmpvar_72 = dot (normal_70, lightDir_71);
float tmpvar_73;
tmpvar_73 = max (0.0, tmpvar_72);
return tmpvar_73;
}
float RGBToLuminance (
in vec3 color_74
)
{
float luminance_75;
vec3 lumSensitivity_76;
vec3 tmpvar_77;
tmpvar_77 = vec3(0.299, 0.587, 0.114);
lumSensitivity_76 = tmpvar_77;
float tmpvar_78;
tmpvar_78 = dot (color_74, lumSensitivity_76);
float tmpvar_79;
tmpvar_79 = tmpvar_78;
luminance_75 = tmpvar_79;
return luminance_75;
}
vec3 BRDF_Disney_PBS (
in vec3 baseColor_80,
in vec3 lightColor_81,
in vec3 specColor_82,
in float specular_83,
in float roughness_84,
in vec3 normal_85,
in vec3 lightDir_86,
in vec3 viewDir_87,
in vec3 ambient_88,
in vec3 env_89
)
{
vec3 color_90;
vec3 diffuseColor_91;
float diffuseTerm_92;
float specularTerm_93;
float disneyDiffuse_94;
float nvPow_95;
float nlPow_96;
float Fd90_97;
float R_98;
float G_99;
float F_100;
float lh_101;
float lv_102;
float vh_103;
float nv_104;
float nh_105;
float nl_106;
vec3 halfDir_107;
vec3 tmpvar_108;
tmpvar_108 = normalize ((lightDir_86 + viewDir_87));
vec3 tmpvar_109;
tmpvar_109 = tmpvar_108;
halfDir_107 = tmpvar_109;
float tmpvar_110;
tmpvar_110 = LambertTerm (normal_85, lightDir_86);
float tmpvar_111;
tmpvar_111 = tmpvar_110;
nl_106 = tmpvar_111;
float tmpvar_112;
tmpvar_112 = BlinnTerm (normal_85, halfDir_107);
float tmpvar_113;
tmpvar_113 = tmpvar_112;
nh_105 = tmpvar_113;
float tmpvar_114;
tmpvar_114 = dot (normal_85, viewDir_87);
float tmpvar_115;
tmpvar_115 = max (0.0, tmpvar_114);
float tmpvar_116;
tmpvar_116 = tmpvar_115;
nv_104 = tmpvar_116;
float tmpvar_117;
tmpvar_117 = dot (viewDir_87, halfDir_107);
float tmpvar_118;
tmpvar_118 = max (0.0, tmpvar_117);
float tmpvar_119;
tmpvar_119 = tmpvar_118;
vh_103 = tmpvar_119;
float tmpvar_120;
tmpvar_120 = dot (lightDir_86, viewDir_87);
float tmpvar_121;
tmpvar_121 = max (0.0, tmpvar_120);
float tmpvar_122;
tmpvar_122 = tmpvar_121;
lv_102 = tmpvar_122;
float tmpvar_123;
tmpvar_123 = dot (lightDir_86, halfDir_107);
float tmpvar_124;
tmpvar_124 = max (0.0, tmpvar_123);
float tmpvar_125;
tmpvar_125 = tmpvar_124;
lh_101 = tmpvar_125;
float tmpvar_126;
tmpvar_126 = FresnelTerm (specular_83, vh_103);
float tmpvar_127;
tmpvar_127 = tmpvar_126;
F_100 = tmpvar_127;
float tmpvar_128;
tmpvar_128 = GeometricTerm (nl_106, nh_105, nv_104, vh_103, lv_102);
float tmpvar_129;
tmpvar_129 = tmpvar_128;
G_99 = tmpvar_129;
float tmpvar_130;
tmpvar_130 = BlinnPhongTerm (roughness_84, nh_105);
float tmpvar_131;
tmpvar_131 = tmpvar_130;
R_98 = tmpvar_131;
float tmpvar_132;
tmpvar_132 = max (0.0, R_98);
float tmpvar_133;
tmpvar_133 = tmpvar_132;
R_98 = tmpvar_133;
float tmpvar_134;
tmpvar_134 = pow (lh_101, 2.0);
float tmpvar_135;
tmpvar_135 = (0.5 + ((2.0 * tmpvar_134) * roughness_84));
Fd90_97 = tmpvar_135;
float tmpvar_136;
tmpvar_136 = pow ((1.00001 - nl_106), 5.0);
float tmpvar_137;
tmpvar_137 = tmpvar_136;
nlPow_96 = tmpvar_137;
float tmpvar_138;
tmpvar_138 = pow ((1.00001 - nv_104), 5.0);
float tmpvar_139;
tmpvar_139 = tmpvar_138;
nvPow_95 = tmpvar_139;
float tmpvar_140;
tmpvar_140 = ((1.0 + (
(Fd90_97 - 1.0)
* nlPow_96)) * (1.0 + (
(Fd90_97 - 1.0)
* nvPow_95)));
disneyDiffuse_94 = tmpvar_140;
float tmpvar_141;
tmpvar_141 = max (0.0, (((F_100 * G_99) * R_98) / ((4.0 * nv_104) + 1e-05)));
float tmpvar_142;
tmpvar_142 = tmpvar_141;
specularTerm_93 = tmpvar_142;
float tmpvar_143;
tmpvar_143 = (disneyDiffuse_94 * nl_106);
diffuseTerm_92 = tmpvar_143;
vec3 tmpvar_144;
tmpvar_144 = baseColor_80;
diffuseColor_91 = tmpvar_144;
float tmpvar_145;
tmpvar_145 = RGBToLuminance (specColor_82);
float tmpvar_146;
tmpvar_146 = FresnelTerm (0.0, nv_104);
vec3 tmpvar_147;
tmpvar_147 = (((diffuseColor_91 *
(ambient_88 + (diffuseTerm_92 * lightColor_81))
) + (specColor_82 *
(env_89 + (lightColor_81 * specularTerm_93))
)) + ((
((1.0 - tmpvar_145) * (1.0 - roughness_84))
* tmpvar_146) * env_89));
color_90 = tmpvar_147;
return color_90;
}
vec3 DecodeLightmap (
in vec4 color_148
)
{
return ((8.0 * color_148.w) * color_148.xyz);
}
vec3 DirLightmapDiffuse (
in mat3 dirBasis_149,
in vec4 color_150,
in vec4 scale_151,
in vec3 normal_152,
in bool surfFuncWritesNormal_153,
out vec3 scalePerBasisVector_154
)
{
vec3 lm_155;
vec3 tmpvar_156;
tmpvar_156 = DecodeLightmap (color_150);
vec3 tmpvar_157;
tmpvar_157 = tmpvar_156;
lm_155 = tmpvar_157;
vec3 tmpvar_158;
tmpvar_158 = DecodeLightmap (scale_151);
vec3 tmpvar_159;
tmpvar_159 = tmpvar_158;
scalePerBasisVector_154 = tmpvar_159;
if (surfFuncWritesNormal_153) {
vec3 normalInRnmBasis_160;
vec3 tmpvar_161;
tmpvar_161 = xll_saturate_vf3 ((dirBasis_149 * normal_152));
vec3 tmpvar_162;
tmpvar_162 = tmpvar_161;
normalInRnmBasis_160 = tmpvar_162;
float tmpvar_163;
tmpvar_163 = dot (normalInRnmBasis_160, scalePerBasisVector_154);
vec3 tmpvar_164;
tmpvar_164 = (lm_155 * tmpvar_163);
lm_155 = tmpvar_164;
};
return lm_155;
}
void DecodeDirLightmap (
in vec3 normal_165,
in vec4 colorLM_166,
in vec4 scaleLM_167,
out vec3 lightColor_168,
out vec3 lightDir_169
)
{
vec3 scalePerBasisVector_170;
mat3 unity_DirBasis_171;
mat3 tmpvar_172;
tmpvar_172 = xll_transpose_mf3x3 (mat3(0.816497, 0.0, 0.57735, -0.408248, 0.707107, 0.57735, -0.408248, -0.707107, 0.57735));
mat3 tmpvar_173;
tmpvar_173 = tmpvar_172;
unity_DirBasis_171 = tmpvar_173;
vec3 tmpvar_174;
tmpvar_174 = DirLightmapDiffuse (unity_DirBasis_171, colorLM_166, scaleLM_167, normal_165, bool(1), scalePerBasisVector_170);
vec3 tmpvar_175;
tmpvar_175 = tmpvar_174;
lightColor_168 = tmpvar_175;
vec3 tmpvar_176;
tmpvar_176 = xll_matrixindex_mf3x3_i (unity_DirBasis_171, 0);
vec3 tmpvar_177;
tmpvar_177 = xll_matrixindex_mf3x3_i (unity_DirBasis_171, 1);
vec3 tmpvar_178;
tmpvar_178 = xll_matrixindex_mf3x3_i (unity_DirBasis_171, 2);
vec3 tmpvar_179;
tmpvar_179 = normalize ((((scalePerBasisVector_170.x * tmpvar_176) + (scalePerBasisVector_170.y * tmpvar_177)) + (scalePerBasisVector_170.z * tmpvar_178)));
vec3 tmpvar_180;
tmpvar_180 = tmpvar_179;
lightDir_169 = tmpvar_180;
}
vec3 EnergyCalculator (
in vec3 specColor_181,
in float specular_182,
in vec3 baseColor_183
)
{
vec3 tmpvar_184;
tmpvar_184 = min (baseColor_183, (vec3(1.0, 1.0, 1.0) - specular_182));
return tmpvar_184;
}
float toLinearFast1 (
in float c_185
)
{
float c2_186;
float tmpvar_187;
tmpvar_187 = (c_185 * c_185);
c2_186 = tmpvar_187;
vec2 tmpvar_188;
tmpvar_188.x = c2_186;
tmpvar_188.y = (c_185 * c2_186);
float tmpvar_189;
tmpvar_189 = dot (vec2(0.7532, 0.2468), tmpvar_188);
return tmpvar_189;
}
vec3 fromRGBM (
in vec4 c_190
)
{
float tmpvar_191;
tmpvar_191 = toLinearFast1 (c_190.w);
return ((c_190.xyz * tmpvar_191) * _Exposure);
}
vec3 EnvMap (
in vec4 worldNormal_192
)
{
vec4 envTexel_193;
vec4 tmpvar_194;
tmpvar_194.xyz = worldNormal_192.xyz.xyz;
tmpvar_194.w = worldNormal_192.w;
vec4 tmpvar_195;
tmpvar_195 = xll_texCUBElod (_SpecCube, tmpvar_194);
vec4 tmpvar_196;
tmpvar_196 = tmpvar_195;
envTexel_193 = tmpvar_196;
vec3 tmpvar_197;
tmpvar_197 = fromRGBM (envTexel_193);
return tmpvar_197;
}
float Occlusion (
in vec2 uv_198
)
{
vec4 tmpvar_199;
tmpvar_199 = texture2D (_Occlusion, uv_198);
return tmpvar_199.x;
}
vec4 SpecularGloss (
in vec2 uv_200
)
{
vec4 specGloss_201;
vec4 tmpvar_202;
tmpvar_202 = texture2D (_SpecGlossMap, uv_200);
vec4 tmpvar_203;
tmpvar_203 = tmpvar_202;
specGloss_201 = tmpvar_203;
vec4 tmpvar_204;
tmpvar_204.xyz = specGloss_201.xyz.xyz;
tmpvar_204.w = specGloss_201.w;
return tmpvar_204;
}
vec3 BlendNormals (
in vec3 n1_205,
in vec3 n2_206
)
{
vec3 tmpvar_207;
tmpvar_207.xy = (n1_205.xy + n2_206.xy).xy;
tmpvar_207.z = (n1_205.z * n2_206.z);
vec3 tmpvar_208;
tmpvar_208 = normalize (tmpvar_207);
return tmpvar_208;
}
vec3 UnpackScaleNormal (
in vec4 packednormal_209,
in float bumpScale_210
)
{
vec3 normal_211;
vec2 tmpvar_212;
tmpvar_212 = ((packednormal_209.wy * 2.0) - 1.0);
normal_211.xy = tmpvar_212.xy.xy;
vec2 tmpvar_213;
tmpvar_213 = (normal_211.xy * bumpScale_210);
normal_211.xy = tmpvar_213.xy.xy;
float tmpvar_214;
tmpvar_214 = dot (normal_211.xy, normal_211.xy);
float tmpvar_215;
tmpvar_215 = xll_saturate_f (tmpvar_214);
float tmpvar_216;
tmpvar_216 = sqrt ((1.0 - tmpvar_215));
float tmpvar_217;
tmpvar_217 = tmpvar_216;
normal_211.z = vec3(tmpvar_217).z;
return normal_211;
}
vec3 TangentNormal (
in vec4 texcoords_218
)
{
vec3 detailNormalTangent_219;
vec3 normalTangent_220;
vec4 tmpvar_221;
tmpvar_221 = texture2D (_BumpMap, texcoords_218.xy);
vec3 tmpvar_222;
tmpvar_222 = UnpackScaleNormal (tmpvar_221, _BumpScale);
vec3 tmpvar_223;
tmpvar_223 = tmpvar_222;
normalTangent_220 = tmpvar_223;
vec4 tmpvar_224;
tmpvar_224 = texture2D (_DetailNormalMap, texcoords_218.zw);
vec3 tmpvar_225;
tmpvar_225 = UnpackScaleNormal (tmpvar_224, _DetailNormalMapScale);
vec3 tmpvar_226;
tmpvar_226 = tmpvar_225;
detailNormalTangent_219 = tmpvar_226;
vec3 tmpvar_227;
tmpvar_227 = BlendNormals (normalTangent_220, detailNormalTangent_219);
vec3 tmpvar_228;
tmpvar_228 = tmpvar_227;
normalTangent_220 = tmpvar_228;
return normalTangent_220;
}
mat3 TangentToWorld (
in vec3 normal_229,
in vec3 tangent_230,
in vec3 flip_231
)
{
vec3 binormal_232;
vec3 tmpvar_233;
tmpvar_233 = cross (normal_229, tangent_230);
vec3 tmpvar_234;
tmpvar_234 = (tmpvar_233 * flip_231);
binormal_232 = tmpvar_234;
mat3 tmpvar_235;
vec3 tmpvar_236;
tmpvar_236 = tangent_230;
tmpvar_235[0] = tmpvar_236;
vec3 tmpvar_237;
tmpvar_237 = binormal_232;
tmpvar_235[1] = tmpvar_237;
vec3 tmpvar_238;
tmpvar_238 = normal_229;
tmpvar_235[2] = tmpvar_238;
mat3 tmpvar_239;
tmpvar_239 = xll_transpose_mf3x3 (tmpvar_235);
return tmpvar_239;
}
float unitySampleShadow (
in vec4 shadowCoord_240
)
{
float shadow_241;
vec4 tmpvar_242;
tmpvar_242 = texture2DProj (_ShadowMapTexture, shadowCoord_240);
float tmpvar_243;
tmpvar_243 = tmpvar_242.x;
shadow_241 = tmpvar_243;
return shadow_241;
}
vec4 frag (
in VertexOutput i_244
)
{
float alpha_245;
vec3 color_246;
vec3 baseColor_247;
vec3 lightDirTangent_248;
vec4 lmIndTex_249;
vec4 lmtex_250;
vec3 ambient_251;
float subsurface_252;
vec3 lightDir_253;
vec3 lightColor_254;
vec3 env_255;
float roughness_256;
float specular_257;
vec3 specColor_258;
vec4 specGloss_259;
vec3 eyeVec_260;
vec3 normalWorld_261;
vec3 normalTangent_262;
mat3 tanToWorld_263;
float atten_264;
float tmpvar_265;
tmpvar_265 = unitySampleShadow (i_244._ShadowCoord);
float tmpvar_266;
tmpvar_266 = tmpvar_265;
atten_264 = tmpvar_266;
vec3 tmpvar_267;
tmpvar_267 = vec3(i_244.tangentWorld.w);
mat3 tmpvar_268;
tmpvar_268 = TangentToWorld (i_244.normalWorld, i_244.tangentWorld.xyz, tmpvar_267);
mat3 tmpvar_269;
tmpvar_269 = tmpvar_268;
tanToWorld_263 = tmpvar_269;
vec3 tmpvar_270;
tmpvar_270 = normalize (i_244.normalWorld);
vec3 tmpvar_271;
tmpvar_271 = tmpvar_270;
i_244.normalWorld = tmpvar_271;
vec3 tmpvar_272;
tmpvar_272 = TangentNormal (i_244.tex);
vec3 tmpvar_273;
tmpvar_273 = tmpvar_272;
normalTangent_262 = tmpvar_273;
vec3 tmpvar_274;
tmpvar_274 = (normalTangent_262 * tanToWorld_263);
normalWorld_261 = tmpvar_274;
vec3 tmpvar_275;
tmpvar_275 = normalize ((i_244.posWorld.xyz - _WorldSpaceCameraPos));
vec3 tmpvar_276;
tmpvar_276 = tmpvar_275;
eyeVec_260 = tmpvar_276;
vec4 tmpvar_277;
tmpvar_277 = SpecularGloss (i_244.tex.xy);
vec4 tmpvar_278;
tmpvar_278 = tmpvar_277;
specGloss_259 = tmpvar_278;
vec3 tmpvar_279;
tmpvar_279 = specGloss_259.xyz;
specColor_258 = tmpvar_279;
float tmpvar_280;
tmpvar_280 = RGBToLuminance (specGloss_259.xyz);
float tmpvar_281;
tmpvar_281 = tmpvar_280;
specular_257 = tmpvar_281;
float tmpvar_282;
tmpvar_282 = (1.0 - specGloss_259.w);
roughness_256 = tmpvar_282;
vec3 tmpvar_283;
tmpvar_283 = vec3(0.0, 0.0, 0.0);
env_255 = tmpvar_283;
vec3 tmpvar_284;
tmpvar_284 = reflect (eyeVec_260, normalWorld_261);
vec4 tmpvar_285;
tmpvar_285.xyz = tmpvar_284.xyz;
tmpvar_285.w = (roughness_256 * 5.0);
vec3 tmpvar_286;
tmpvar_286 = EnvMap (tmpvar_285);
float tmpvar_287;
tmpvar_287 = Occlusion (i_244.tex.xy);
vec3 tmpvar_288;
tmpvar_288 = (tmpvar_286 * tmpvar_287);
env_255 = tmpvar_288;
vec3 tmpvar_289;
tmpvar_289 = (_LightColor0.xyz * 2.0);
lightColor_254 = tmpvar_289;
vec3 tmpvar_290;
tmpvar_290 = _WorldSpaceLightPos0.xyz;
lightDir_253 = tmpvar_290;
float tmpvar_291;
tmpvar_291 = 1.0;
subsurface_252 = tmpvar_291;
vec3 tmpvar_292;
tmpvar_292 = vec3(0.0, 0.0, 0.0);
ambient_251 = tmpvar_292;
vec4 tmpvar_293;
tmpvar_293 = texture2D (unity_Lightmap, i_244.extra.xy);
vec4 tmpvar_294;
tmpvar_294 = tmpvar_293;
lmtex_250 = tmpvar_294;
vec4 tmpvar_295;
tmpvar_295 = texture2D (unity_LightmapInd, i_244.extra.xy);
vec4 tmpvar_296;
tmpvar_296 = tmpvar_295;
lmIndTex_249 = tmpvar_296;
DecodeDirLightmap (normalTangent_262, lmtex_250, lmIndTex_249, lightColor_254, lightDirTangent_248);
vec3 tmpvar_297;
tmpvar_297 = (lightDirTangent_248 * tanToWorld_263);
lightDir_253 = tmpvar_297;
vec3 tmpvar_298;
tmpvar_298 = normalize (lightDir_253);
vec3 tmpvar_299;
tmpvar_299 = tmpvar_298;
lightDir_253 = tmpvar_299;
vec3 tmpvar_300;
tmpvar_300 = Albedo (i_244.tex);
vec3 tmpvar_301;
tmpvar_301 = EnergyCalculator (specColor_258, specular_257, tmpvar_300);
vec3 tmpvar_302;
tmpvar_302 = tmpvar_301;
baseColor_247 = tmpvar_302;
vec3 tmpvar_303;
tmpvar_303 = BRDF_Disney_PBS (baseColor_247, (atten_264 * lightColor_254), specColor_258, specular_257, roughness_256, normalWorld_261, lightDir_253, -(eyeVec_260), ambient_251, env_255);
vec3 tmpvar_304;
tmpvar_304 = tmpvar_303;
color_246 = tmpvar_304;
vec4 tmpvar_305;
tmpvar_305 = texture2D (_SelfIllum, i_244.tex.xy);
vec3 tmpvar_306;
tmpvar_306 = (color_246 + (tmpvar_305.xyz * _SelfIllumScale));
color_246 = tmpvar_306;
float tmpvar_307;
tmpvar_307 = Alpha (i_244.tex.xy);
float tmpvar_308;
tmpvar_308 = tmpvar_307;
alpha_245 = tmpvar_308;
vec4 tmpvar_309;
tmpvar_309.xyz = color_246.xyz;
tmpvar_309.w = alpha_245;
return tmpvar_309;
}
void main ()
{
VertexOutput xlt_i_310;
vec4 xl_retval_311;
vec4 tmpvar_312;
tmpvar_312 = vec4(0.0, 0.0, 0.0, 0.0);
xlt_i_310.pos = tmpvar_312;
vec4 tmpvar_313;
tmpvar_313 = xlv_TEXCOORD0.xyzw;
vec4 tmpvar_314;
tmpvar_314 = tmpvar_313;
xlt_i_310.tex = tmpvar_314;
vec4 tmpvar_315;
tmpvar_315 = xlv_TEXCOORD1.xyzw;
vec4 tmpvar_316;
tmpvar_316 = tmpvar_315;
xlt_i_310.posWorld = tmpvar_316;
vec3 tmpvar_317;
tmpvar_317 = xlv_TEXCOORD2.xyz;
vec3 tmpvar_318;
tmpvar_318 = tmpvar_317;
xlt_i_310.normalWorld = tmpvar_318;
vec4 tmpvar_319;
tmpvar_319 = xlv_TEXCOORD3.xyzw;
vec4 tmpvar_320;
tmpvar_320 = tmpvar_319;
xlt_i_310.tangentWorld = tmpvar_320;
vec3 tmpvar_321;
tmpvar_321 = xlv_TEXCOORD4.xyz;
vec3 tmpvar_322;
tmpvar_322 = tmpvar_321;
xlt_i_310.extra = tmpvar_322;
vec4 tmpvar_323;
tmpvar_323 = xlv_TEXCOORD5.xyzw;
vec4 tmpvar_324;
tmpvar_324 = tmpvar_323;
xlt_i_310._ShadowCoord = tmpvar_324;
vec3 tmpvar_325;
tmpvar_325 = xlv_TEXCOORD7.xyz;
vec3 tmpvar_326;
tmpvar_326 = tmpvar_325;
xlt_i_310.lightDir = tmpvar_326;
vec4 tmpvar_327;
tmpvar_327 = frag (xlt_i_310);
vec4 tmpvar_328;
tmpvar_328 = tmpvar_327;
xl_retval_311 = tmpvar_328;
vec4 tmpvar_329;
tmpvar_329 = xl_retval_311.xyzw;
vec4 tmpvar_330;
tmpvar_330 = tmpvar_329;
gl_FragData[0] = tmpvar_330;
}