2012-10-08 07:41:18 +04:00
|
|
|
struct LeafSurfaceOutput {
|
|
|
|
vec3 Albedo;
|
|
|
|
vec3 Normal;
|
|
|
|
vec3 Emission;
|
|
|
|
float Translucency;
|
|
|
|
float ShadowOffset;
|
|
|
|
float Specular;
|
|
|
|
float Gloss;
|
|
|
|
float Alpha;
|
|
|
|
};
|
|
|
|
struct Input {
|
|
|
|
vec2 uv_MainTex;
|
|
|
|
vec4 color;
|
|
|
|
};
|
|
|
|
struct v2f_surf {
|
|
|
|
vec4 pos;
|
|
|
|
vec2 hip_pack0;
|
|
|
|
vec4 lop_color;
|
|
|
|
vec3 lightDir;
|
|
|
|
vec3 viewDir;
|
|
|
|
vec2 _LightCoord;
|
|
|
|
};
|
|
|
|
uniform sampler2D _BumpSpecMap;
|
2014-02-11 11:06:13 +04:00
|
|
|
uniform vec4 _Color;
|
|
|
|
uniform float _Cutoff;
|
|
|
|
uniform vec4 _LightColor0;
|
|
|
|
uniform sampler2D _LightTexture0;
|
|
|
|
uniform sampler2D _MainTex;
|
|
|
|
uniform float _ShadowStrength;
|
|
|
|
uniform vec3 _TranslucencyColor;
|
|
|
|
uniform sampler2D _TranslucencyMap;
|
|
|
|
uniform float _TranslucencyViewDependency;
|
|
|
|
varying vec2 xlv_TEXCOORD0;
|
|
|
|
varying vec4 xlv_COLOR0;
|
|
|
|
varying vec3 xlv_TEXCOORD1;
|
|
|
|
varying vec3 xlv_TEXCOORD2;
|
|
|
|
varying vec2 xlv_TEXCOORD3;
|
2012-10-08 07:41:18 +04:00
|
|
|
void xll_clip (
|
|
|
|
in float x_1
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if ((x_1 < 0.0)) {
|
|
|
|
discard;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
float xll_saturate (
|
|
|
|
in float x_2
|
|
|
|
)
|
|
|
|
{
|
|
|
|
float tmpvar_3;
|
|
|
|
tmpvar_3 = clamp (x_2, 0.0, 1.0);
|
|
|
|
return tmpvar_3;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec2 xll_saturate (
|
|
|
|
in vec2 x_4
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec2 tmpvar_5;
|
|
|
|
tmpvar_5 = clamp (x_4, 0.0, 1.0);
|
|
|
|
return tmpvar_5;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec3 xll_saturate (
|
|
|
|
in vec3 x_6
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec3 tmpvar_7;
|
|
|
|
tmpvar_7 = clamp (x_6, 0.0, 1.0);
|
|
|
|
return tmpvar_7;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec4 xll_saturate (
|
|
|
|
in vec4 x_8
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec4 tmpvar_9;
|
|
|
|
tmpvar_9 = clamp (x_8, 0.0, 1.0);
|
|
|
|
return tmpvar_9;
|
|
|
|
}
|
|
|
|
|
|
|
|
mat2 xll_saturate (
|
|
|
|
in mat2 m_10
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec2 tmpvar_11;
|
|
|
|
tmpvar_11 = clamp (m_10[0], 0.0, 1.0);
|
|
|
|
vec2 tmpvar_12;
|
|
|
|
tmpvar_12 = clamp (m_10[1], 0.0, 1.0);
|
|
|
|
mat2 tmpvar_13;
|
|
|
|
vec2 tmpvar_14;
|
|
|
|
tmpvar_14 = tmpvar_11;
|
|
|
|
tmpvar_13[0] = tmpvar_14;
|
|
|
|
vec2 tmpvar_15;
|
|
|
|
tmpvar_15 = tmpvar_12;
|
|
|
|
tmpvar_13[1] = tmpvar_15;
|
|
|
|
return tmpvar_13;
|
|
|
|
}
|
|
|
|
|
|
|
|
mat3 xll_saturate (
|
|
|
|
in mat3 m_16
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec3 tmpvar_17;
|
|
|
|
tmpvar_17 = clamp (m_16[0], 0.0, 1.0);
|
|
|
|
vec3 tmpvar_18;
|
|
|
|
tmpvar_18 = clamp (m_16[1], 0.0, 1.0);
|
|
|
|
vec3 tmpvar_19;
|
|
|
|
tmpvar_19 = clamp (m_16[2], 0.0, 1.0);
|
|
|
|
mat3 tmpvar_20;
|
|
|
|
vec3 tmpvar_21;
|
|
|
|
tmpvar_21 = tmpvar_17;
|
|
|
|
tmpvar_20[0] = tmpvar_21;
|
|
|
|
vec3 tmpvar_22;
|
|
|
|
tmpvar_22 = tmpvar_18;
|
|
|
|
tmpvar_20[1] = tmpvar_22;
|
|
|
|
vec3 tmpvar_23;
|
|
|
|
tmpvar_23 = tmpvar_19;
|
|
|
|
tmpvar_20[2] = tmpvar_23;
|
|
|
|
return tmpvar_20;
|
|
|
|
}
|
|
|
|
|
|
|
|
mat4 xll_saturate (
|
|
|
|
in mat4 m_24
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec4 tmpvar_25;
|
|
|
|
tmpvar_25 = clamp (m_24[0], 0.0, 1.0);
|
|
|
|
vec4 tmpvar_26;
|
|
|
|
tmpvar_26 = clamp (m_24[1], 0.0, 1.0);
|
|
|
|
vec4 tmpvar_27;
|
|
|
|
tmpvar_27 = clamp (m_24[2], 0.0, 1.0);
|
|
|
|
vec4 tmpvar_28;
|
|
|
|
tmpvar_28 = clamp (m_24[3], 0.0, 1.0);
|
|
|
|
mat4 tmpvar_29;
|
|
|
|
vec4 tmpvar_30;
|
|
|
|
tmpvar_30 = tmpvar_25;
|
|
|
|
tmpvar_29[0] = tmpvar_30;
|
|
|
|
vec4 tmpvar_31;
|
|
|
|
tmpvar_31 = tmpvar_26;
|
|
|
|
tmpvar_29[1] = tmpvar_31;
|
|
|
|
vec4 tmpvar_32;
|
|
|
|
tmpvar_32 = tmpvar_27;
|
|
|
|
tmpvar_29[2] = tmpvar_32;
|
|
|
|
vec4 tmpvar_33;
|
|
|
|
tmpvar_33 = tmpvar_28;
|
|
|
|
tmpvar_29[3] = tmpvar_33;
|
|
|
|
return tmpvar_29;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec4 UnpackNormal (
|
|
|
|
in vec4 packednormal_34
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec4 normal_35;
|
|
|
|
vec2 tmpvar_36;
|
|
|
|
tmpvar_36 = ((packednormal_34.wy * 2.0) - 1.0);
|
|
|
|
normal_35.xy = tmpvar_36.xy.xy;
|
|
|
|
float tmpvar_37;
|
|
|
|
tmpvar_37 = sqrt (((1.0 - (normal_35.x * normal_35.x)) - (normal_35.y * normal_35.y)));
|
|
|
|
float tmpvar_38;
|
|
|
|
tmpvar_38 = tmpvar_37;
|
|
|
|
normal_35.z = vec3(tmpvar_38).z;
|
|
|
|
return normal_35;
|
|
|
|
}
|
|
|
|
|
|
|
|
void surf (
|
|
|
|
in Input IN_39,
|
|
|
|
inout LeafSurfaceOutput o_40
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec4 norspc_41;
|
|
|
|
vec4 trngls_42;
|
|
|
|
vec4 c_43;
|
|
|
|
vec4 tmpvar_44;
|
|
|
|
tmpvar_44 = texture2D (_MainTex, IN_39.uv_MainTex);
|
|
|
|
vec4 tmpvar_45;
|
|
|
|
tmpvar_45 = tmpvar_44;
|
|
|
|
c_43 = tmpvar_45;
|
|
|
|
vec3 tmpvar_46;
|
|
|
|
tmpvar_46 = ((c_43.xyz * _Color.xyz) * IN_39.color.w);
|
|
|
|
o_40.Albedo = tmpvar_46;
|
|
|
|
vec4 tmpvar_47;
|
|
|
|
tmpvar_47 = texture2D (_TranslucencyMap, IN_39.uv_MainTex);
|
|
|
|
vec4 tmpvar_48;
|
|
|
|
tmpvar_48 = tmpvar_47;
|
|
|
|
trngls_42 = tmpvar_48;
|
|
|
|
float tmpvar_49;
|
|
|
|
tmpvar_49 = trngls_42.z;
|
|
|
|
o_40.Translucency = tmpvar_49;
|
|
|
|
float tmpvar_50;
|
|
|
|
tmpvar_50 = (trngls_42.w * _Color.x);
|
|
|
|
o_40.Gloss = tmpvar_50;
|
|
|
|
float tmpvar_51;
|
|
|
|
tmpvar_51 = c_43.w;
|
|
|
|
o_40.Alpha = tmpvar_51;
|
|
|
|
vec4 tmpvar_52;
|
|
|
|
tmpvar_52 = texture2D (_BumpSpecMap, IN_39.uv_MainTex);
|
|
|
|
vec4 tmpvar_53;
|
|
|
|
tmpvar_53 = tmpvar_52;
|
|
|
|
norspc_41 = tmpvar_53;
|
|
|
|
float tmpvar_54;
|
|
|
|
tmpvar_54 = norspc_41.x;
|
|
|
|
o_40.Specular = tmpvar_54;
|
|
|
|
float tmpvar_55;
|
|
|
|
tmpvar_55 = norspc_41.z;
|
|
|
|
o_40.ShadowOffset = tmpvar_55;
|
|
|
|
vec4 tmpvar_56;
|
|
|
|
tmpvar_56 = UnpackNormal (norspc_41);
|
|
|
|
vec3 tmpvar_57;
|
|
|
|
tmpvar_57 = tmpvar_56.xyz;
|
|
|
|
vec3 tmpvar_58;
|
|
|
|
tmpvar_58 = tmpvar_57;
|
|
|
|
o_40.Normal = tmpvar_58;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec4 LightingTreeLeaf (
|
|
|
|
in LeafSurfaceOutput s_59,
|
|
|
|
in vec3 lightDir_60,
|
|
|
|
in vec3 viewDir_61,
|
|
|
|
in float atten_62
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec4 c_63;
|
|
|
|
vec3 translucencyColor_64;
|
|
|
|
float backContrib_65;
|
|
|
|
float spec_66;
|
|
|
|
float nh_67;
|
|
|
|
float nl_68;
|
|
|
|
vec3 h_69;
|
|
|
|
vec3 tmpvar_70;
|
|
|
|
tmpvar_70 = normalize ((lightDir_60 + viewDir_61));
|
|
|
|
vec3 tmpvar_71;
|
|
|
|
tmpvar_71 = tmpvar_70;
|
|
|
|
h_69 = tmpvar_71;
|
|
|
|
float tmpvar_72;
|
|
|
|
tmpvar_72 = dot (s_59.Normal, lightDir_60);
|
|
|
|
float tmpvar_73;
|
|
|
|
tmpvar_73 = tmpvar_72;
|
|
|
|
nl_68 = tmpvar_73;
|
|
|
|
float tmpvar_74;
|
|
|
|
tmpvar_74 = dot (s_59.Normal, h_69);
|
|
|
|
float tmpvar_75;
|
|
|
|
tmpvar_75 = max (0.0, tmpvar_74);
|
|
|
|
float tmpvar_76;
|
|
|
|
tmpvar_76 = tmpvar_75;
|
|
|
|
nh_67 = tmpvar_76;
|
|
|
|
float tmpvar_77;
|
|
|
|
tmpvar_77 = pow (nh_67, (s_59.Specular * 128.0));
|
|
|
|
float tmpvar_78;
|
|
|
|
tmpvar_78 = (tmpvar_77 * s_59.Gloss);
|
|
|
|
spec_66 = tmpvar_78;
|
|
|
|
float tmpvar_79;
|
|
|
|
tmpvar_79 = dot (viewDir_61, -(lightDir_60));
|
|
|
|
float tmpvar_80;
|
|
|
|
tmpvar_80 = xll_saturate (tmpvar_79);
|
|
|
|
float tmpvar_81;
|
|
|
|
tmpvar_81 = tmpvar_80;
|
|
|
|
backContrib_65 = tmpvar_81;
|
|
|
|
float tmpvar_82;
|
|
|
|
tmpvar_82 = xll_saturate (-(nl_68));
|
|
|
|
float tmpvar_83;
|
|
|
|
tmpvar_83 = mix (tmpvar_82, backContrib_65, _TranslucencyViewDependency);
|
|
|
|
float tmpvar_84;
|
|
|
|
tmpvar_84 = tmpvar_83;
|
|
|
|
backContrib_65 = tmpvar_84;
|
|
|
|
vec3 tmpvar_85;
|
|
|
|
tmpvar_85 = ((backContrib_65 * s_59.Translucency) * _TranslucencyColor);
|
|
|
|
translucencyColor_64 = tmpvar_85;
|
|
|
|
float tmpvar_86;
|
|
|
|
tmpvar_86 = max (0.0, ((nl_68 * 0.6) + 0.4));
|
|
|
|
float tmpvar_87;
|
|
|
|
tmpvar_87 = tmpvar_86;
|
|
|
|
nl_68 = tmpvar_87;
|
|
|
|
vec3 tmpvar_88;
|
|
|
|
tmpvar_88 = (s_59.Albedo * ((translucencyColor_64 * 2.0) + nl_68));
|
|
|
|
c_63.xyz = tmpvar_88.xyz.xyz;
|
|
|
|
vec3 tmpvar_89;
|
|
|
|
tmpvar_89 = ((c_63.xyz * _LightColor0.xyz) + spec_66);
|
|
|
|
c_63.xyz = tmpvar_89.xyz.xyz;
|
|
|
|
float tmpvar_90;
|
|
|
|
tmpvar_90 = mix (2.0, (atten_62 * 2.0), _ShadowStrength);
|
|
|
|
vec3 tmpvar_91;
|
|
|
|
tmpvar_91 = (c_63.xyz * tmpvar_90);
|
|
|
|
c_63.xyz = tmpvar_91.xyz.xyz;
|
|
|
|
return c_63;
|
|
|
|
}
|
|
|
|
|
|
|
|
vec4 xlat_main (
|
|
|
|
in v2f_surf IN_92
|
|
|
|
)
|
|
|
|
{
|
|
|
|
vec4 c_93;
|
|
|
|
vec3 lightDir_94;
|
|
|
|
LeafSurfaceOutput o_95;
|
|
|
|
Input surfIN_96;
|
|
|
|
vec2 tmpvar_97;
|
|
|
|
tmpvar_97 = IN_92.hip_pack0.xy;
|
|
|
|
surfIN_96.uv_MainTex = tmpvar_97;
|
|
|
|
vec4 tmpvar_98;
|
|
|
|
tmpvar_98 = IN_92.lop_color;
|
|
|
|
surfIN_96.color = tmpvar_98;
|
|
|
|
vec3 tmpvar_99;
|
|
|
|
tmpvar_99 = vec3(0.0, 0.0, 0.0);
|
|
|
|
o_95.Albedo = tmpvar_99;
|
|
|
|
vec3 tmpvar_100;
|
|
|
|
tmpvar_100 = vec3(0.0, 0.0, 0.0);
|
|
|
|
o_95.Emission = tmpvar_100;
|
|
|
|
float tmpvar_101;
|
|
|
|
tmpvar_101 = 0.0;
|
|
|
|
o_95.Specular = tmpvar_101;
|
|
|
|
float tmpvar_102;
|
|
|
|
tmpvar_102 = 0.0;
|
|
|
|
o_95.Alpha = tmpvar_102;
|
|
|
|
surf (surfIN_96, o_95);
|
|
|
|
xll_clip ((o_95.Alpha - _Cutoff));
|
|
|
|
vec3 tmpvar_103;
|
|
|
|
tmpvar_103 = IN_92.lightDir;
|
|
|
|
lightDir_94 = tmpvar_103;
|
|
|
|
vec3 tmpvar_104;
|
|
|
|
tmpvar_104 = IN_92.viewDir.xyz;
|
|
|
|
vec3 tmpvar_105;
|
|
|
|
tmpvar_105 = normalize (tmpvar_104);
|
|
|
|
vec4 tmpvar_106;
|
|
|
|
tmpvar_106 = texture2D (_LightTexture0, IN_92._LightCoord);
|
|
|
|
vec4 tmpvar_107;
|
|
|
|
tmpvar_107 = LightingTreeLeaf (o_95, lightDir_94, tmpvar_105, (tmpvar_106.w * 1.0));
|
|
|
|
vec4 tmpvar_108;
|
|
|
|
tmpvar_108 = tmpvar_107;
|
|
|
|
c_93 = tmpvar_108;
|
|
|
|
float tmpvar_109;
|
|
|
|
tmpvar_109 = o_95.Alpha;
|
|
|
|
c_93.w = vec4(tmpvar_109).w;
|
|
|
|
return c_93;
|
|
|
|
}
|
|
|
|
|
|
|
|
void main ()
|
|
|
|
{
|
|
|
|
v2f_surf xlt_IN_110;
|
|
|
|
vec4 xl_retval_111;
|
|
|
|
vec4 tmpvar_112;
|
|
|
|
tmpvar_112 = vec4(0.0, 0.0, 0.0, 0.0);
|
|
|
|
xlt_IN_110.pos = tmpvar_112;
|
|
|
|
vec2 tmpvar_113;
|
|
|
|
tmpvar_113 = xlv_TEXCOORD0.xy;
|
|
|
|
vec2 tmpvar_114;
|
|
|
|
tmpvar_114 = tmpvar_113;
|
|
|
|
xlt_IN_110.hip_pack0 = tmpvar_114;
|
|
|
|
vec4 tmpvar_115;
|
|
|
|
tmpvar_115 = xlv_COLOR0.xyzw;
|
|
|
|
vec4 tmpvar_116;
|
|
|
|
tmpvar_116 = tmpvar_115;
|
|
|
|
xlt_IN_110.lop_color = tmpvar_116;
|
|
|
|
vec3 tmpvar_117;
|
|
|
|
tmpvar_117 = xlv_TEXCOORD1.xyz;
|
|
|
|
vec3 tmpvar_118;
|
|
|
|
tmpvar_118 = tmpvar_117;
|
|
|
|
xlt_IN_110.lightDir = tmpvar_118;
|
|
|
|
vec3 tmpvar_119;
|
|
|
|
tmpvar_119 = xlv_TEXCOORD2.xyz;
|
|
|
|
vec3 tmpvar_120;
|
|
|
|
tmpvar_120 = tmpvar_119;
|
|
|
|
xlt_IN_110.viewDir = tmpvar_120;
|
|
|
|
vec2 tmpvar_121;
|
|
|
|
tmpvar_121 = xlv_TEXCOORD3.xy;
|
|
|
|
vec2 tmpvar_122;
|
|
|
|
tmpvar_122 = tmpvar_121;
|
|
|
|
xlt_IN_110._LightCoord = tmpvar_122;
|
|
|
|
vec4 tmpvar_123;
|
|
|
|
tmpvar_123 = xlat_main (xlt_IN_110);
|
|
|
|
vec4 tmpvar_124;
|
|
|
|
tmpvar_124 = tmpvar_123;
|
|
|
|
xl_retval_111 = tmpvar_124;
|
|
|
|
vec4 tmpvar_125;
|
|
|
|
tmpvar_125 = xl_retval_111.xyzw;
|
|
|
|
vec4 tmpvar_126;
|
|
|
|
tmpvar_126 = tmpvar_125;
|
|
|
|
gl_FragData[0] = tmpvar_126;
|
|
|
|
}
|
|
|
|
|