Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Duffuse_Transp_Normal_Dual"
- {
- Properties
- {
- _Distans("_Distans", Float) = -0.7
- _Soft("_Soft", Float) = 0.1
- _MainColor("_MainColor", Color) = (1,1,1,1)
- _MainTex("_MainTex", 2D) = "white" {}
- _Alphatest("Alphatest", Range (0, 1))= 0
- _LightMap("_LightMap", 2D) = "white" {}
- _GIMap("_GIMap", 2D) = "white" {}
- _Contrast("_Contrast", Float) = 1
- _Brightness("_Brightness", Float) = 0.5
- _Normal("_Normal", 2D) = "bump" {}
- _Gloss("_Gloss", Float) = 0
- _Specular("_Specular", Color) = (1,1,1,1)
- _Range("_Range", Float) = 1
- _Frequent("_Frequent", Float) = 0.1
- _Speed("_Speed", Float) = 1
- }
- SubShader
- {
- Tags
- {
- "Queue"="Transparent"
- "IgnoreProjector"="False"
- "RenderType"="TreeTransparentCutout"
- }
- Cull Off
- ZWrite On
- ZTest LEqual
- ColorMask RGBA
- Blend SrcAlpha OneMinusSrcAlpha
- Alphatest Greater [_Alphatest]
- Fog{
- }
- CGPROGRAM
- #pragma surface surf BlinnPhongEditor vertex:vert
- #pragma target 2.0
- float _Distans;
- float _Soft;
- float4 _MainColor;
- sampler2D _MainTex;
- sampler2D _LightMap;
- sampler2D _GIMap;
- float _Contrast;
- float _Brightness;
- sampler2D _Normal;
- float _Gloss;
- float4 _Specular;
- float _Range;
- float _Frequent;
- float _Speed;
- struct EditorSurfaceOutput {
- half3 Albedo;
- half3 Normal;
- half3 Emission;
- half3 Gloss;
- half Specular;
- half Alpha;
- half4 Custom;
- };
- inline half4 LightingBlinnPhongEditor_PrePass (EditorSurfaceOutput s, half4 light)
- {
- half3 spec = light.a * s.Gloss;
- half4 c;
- c.rgb = (s.Albedo * light.rgb + light.rgb * spec);
- c.a = s.Alpha;
- return c;
- }
- inline half4 LightingBlinnPhongEditor (EditorSurfaceOutput s, half3 lightDir, half3 viewDir, half atten)
- {
- half3 h = normalize (lightDir + viewDir);
- half diff = max (0, dot ( lightDir, s.Normal ));
- float nh = max (0, dot (s.Normal, h));
- float spec = pow (nh, s.Specular*128.0);
- half4 res;
- res.rgb = _LightColor0.rgb * diff;
- res.w = spec * Luminance (_LightColor0.rgb);
- res *= atten * 2.0;
- return LightingBlinnPhongEditor_PrePass( s, res );
- }
- struct Input {
- float2 uv_MainTex;
- float4 fullMeshUV2;
- float4 screenPos;
- float2 uv_Normal;
- };
- void vert (inout appdata_full v, out Input o) {
- float4 Multiply0=_Time * _Speed.xxxx;
- float4 Add0=v.vertex + Multiply0;
- float4 Splat0=Add0.y;
- float4 Multiply1=Splat0 * _Frequent.xxxx;
- float4 Sin0=sin(Multiply1);
- float4 Mask0=float4(Sin0.x,0.0,0.0,0.0);
- float4 Multiply2=_Range.xxxx * Mask0;
- float4 Add1=Multiply2 + v.vertex;
- float4 VertexOutputMaster0_1_NoInput = float4(0,0,0,0);
- float4 VertexOutputMaster0_2_NoInput = float4(0,0,0,0);
- float4 VertexOutputMaster0_3_NoInput = float4(0,0,0,0);
- v.vertex = Add1;
- o.fullMeshUV2 = v.texcoord1;
- }
- void surf (Input IN, inout EditorSurfaceOutput o) {
- o.Normal = float3(0.0,0.0,1.0);
- o.Alpha = 1.0;
- o.Albedo = 0.0;
- o.Emission = 0.0;
- o.Gloss = 0.0;
- o.Specular = 0.0;
- o.Custom = 0.0;
- float4 Tex2D2=tex2D(_MainTex,(IN.uv_MainTex.xyxy).xy);
- float4 Multiply5=_MainColor * Tex2D2;
- float4 Tex2D1=tex2D(_GIMap,(IN.fullMeshUV2).xy);
- float4 Splat0=IN.screenPos.z;
- float4 Multiply0=Splat0 * _Soft.xxxx;
- float4 Add0=Multiply0 + _Distans.xxxx;
- float4 Saturate0=saturate(Add0);
- float4 Invert0= float4(1.0, 1.0, 1.0, 1.0) - Saturate0;
- float4 Multiply2=Tex2D1 * Invert0;
- float4 Multiply3=Multiply5 * Multiply2;
- float4 Subtract0=Multiply3 - float4( 0.5,0.5,0.5,0.5 );
- float4 Multiply6=Subtract0 * _Contrast.xxxx;
- float4 Add1=Multiply6 + _Brightness.xxxx;
- float4 Tex2DNormal0=float4(UnpackNormal( tex2D(_Normal,(IN.uv_Normal.xyxy).xy)).xyz, 1.0 );
- float4 Tex2D0=tex2D(_LightMap,(IN.fullMeshUV2).xy);
- float4 Add3=Tex2D1 + Tex2D0;
- float4 Multiply1=Add3 * Saturate0;
- float4 Multiply4=Multiply5 * Multiply1;
- float4 Subtract1=Multiply4 - float4( 0.5,0.5,0.5,0.5 );
- float4 Multiply7=Subtract1 * _Contrast.xxxx;
- float4 Add2=Multiply7 + _Brightness.xxxx;
- float4 Master0_7_NoInput = float4(0,0,0,0);
- float4 Master0_6_NoInput = float4(1,1,1,1);
- o.Albedo = Add1;
- o.Normal = Tex2DNormal0;
- o.Emission = Add2;
- o.Specular = _Gloss.xxxx;
- o.Gloss = _Specular;
- o.Alpha = Tex2D2.aaaa;
- o.Normal = normalize(o.Normal);
- }
- ENDCG
- }
- Fallback "Diffuse"
- }
Advertisement
Add Comment
Please, Sign In to add comment