#line 1 "pp-linenumbers2-in.txt" #line 101 inline half4 UnpackNormal ( half4 packednormal ) { half4 normal ; normal . xy = packednormal . wy * 2 - 1 ; normal . z = sqrt ( 1 - normal . x * normal . x - normal . y * normal . y ) ; return normal ; } float4 _LightColor0 ; float4 _SpecColor ; uniform sampler2D _LightTexture0 ; uniform float4x4 _LightMatrix0 ; #line 1014 float4 _Color ; half3 _TranslucencyColor ; half _TranslucencyViewDependency ; half _ShadowStrength ; struct LeafSurfaceOutput { half3 Albedo ; half3 Normal ; half3 Emission ; half Translucency ; half ShadowOffset ; half Specular ; half Gloss ; half Alpha ; } ; inline half4 LightingTreeLeaf ( LeafSurfaceOutput s , half3 lightDir , half3 viewDir , half atten ) { half3 h = normalize ( lightDir + viewDir ) ; half nl = dot ( s . Normal , lightDir ) ; half nh = max ( 0 , dot ( s . Normal , h ) ) ; half spec = pow ( nh , s . Specular * 128.0 ) * s . Gloss ; half backContrib = saturate ( dot ( viewDir , - lightDir ) ) ; backContrib = lerp ( saturate ( - nl ) , backContrib , _TranslucencyViewDependency ) ; half3 translucencyColor = backContrib * s . Translucency * _TranslucencyColor ; nl = max ( 0 , nl * 0.6 + 0.4 ) ; half4 c ; c . rgb = s . Albedo * ( translucencyColor * 2 + nl ) ; c . rgb = c . rgb * _LightColor0 . rgb + spec ; c . rgb *= lerp ( 2 , atten * 2 , _ShadowStrength ) ; return c ; } #line 10048 sampler2D _MainTex ; sampler2D _BumpSpecMap ; sampler2D _TranslucencyMap ; struct Input { float2 uv_MainTex ; float4 color : COLOR ; } ; void surf ( Input IN , inout LeafSurfaceOutput o ) { half4 c = tex2D ( _MainTex , IN . uv_MainTex ) ; o . Albedo = c . rgb * _Color . rgb * IN . color . a ; half4 trngls = tex2D ( _TranslucencyMap , IN . uv_MainTex ) ; o . Translucency = trngls . b ; o . Gloss = trngls . a * _Color . r ; o . Alpha = c . a ; half4 norspc = tex2D ( _BumpSpecMap , IN . uv_MainTex ) ; o . Specular = norspc . r ; o . ShadowOffset = norspc . b ; o . Normal = UnpackNormal ( norspc ) ; } struct v2f_surf { float4 pos : POSITION ; float2 hip_pack0 : TEXCOORD0 ; float4 lop_color : COLOR0 ; float3 lightDir : TEXCOORD1 ; float3 viewDir : TEXCOORD2 ; float2 _LightCoord : TEXCOORD3 ; } ; float _Cutoff ; half4 main ( v2f_surf IN ) : COLOR { Input surfIN ; surfIN . uv_MainTex = IN . hip_pack0 . xy ; surfIN . color = IN . lop_color ; LeafSurfaceOutput o ; o . Albedo = 0.0 ; o . Emission = 0.0 ; o . Specular = 0.0 ; o . Alpha = 0.0 ; surf ( surfIN , o ) ; clip ( o . Alpha - _Cutoff ) ; half3 lightDir = IN . lightDir ; half4 c = LightingTreeLeaf ( o , lightDir , normalize ( half3 ( IN . viewDir ) ) , ( tex2D ( _LightTexture0 , IN . _LightCoord ) . w * 1.0 ) ) ; c . a = o . Alpha ; return c ; }