123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
- Shader "M/CharacterChange"
- {
- Properties
- {
- _Tex("_Tex", 2D) = "black" {}
- _Speed("_Speed", Float) = 2
- _ColorFresnel("_ColorFresnel", Color) = (1,1,1,1)
- _DistValue("_DistValue", Float) = 0
- _TexTil("_TexTil", Vector) = (2,1,0,0)
- _Diffuse("_Diffuse", 2D) = "black" {}
- }
-
- SubShader
- {
- Tags
- {
- "Queue"="Geometry"
- "IgnoreProjector"="False"
- "RenderType"="Opaque"
- }
-
- Cull Back
- ZWrite On
- ZTest LEqual
- ColorMask RGBA
- Fog{
- }
- CGPROGRAM
- #pragma surface surf BlinnPhongEditor vertex:vert
- #pragma target 2.0
- sampler2D _Tex;
- float _Speed;
- float4 _ColorFresnel;
- float _DistValue;
- float4 _TexTil;
- sampler2D _Diffuse;
- 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_Diffuse;
- float4 screenPos;
- float3 viewDir;
- float3 sWorldNormal;
- };
- void vert (inout appdata_full v, out Input o) {
- UNITY_INITIALIZE_OUTPUT(Input,o);
- float4 VertexOutputMaster0_0_NoInput = float4(0,0,0,0);
- 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);
- o.sWorldNormal = mul((float3x3)unity_ObjectToWorld, SCALED_NORMAL);
- }
-
- 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(_Diffuse,(IN.uv_Diffuse.xyxy).xy);
- float4 Multiply3=((IN.screenPos.xy/IN.screenPos.w).xyxy) * _TexTil;
- float4 Multiply2=_Time * _Speed.xxxx;
- float4 UV_Pan0=float4(Multiply3.x,Multiply3.y + Multiply2.x,Multiply3.z,Multiply3.w);
- float4 Tex2D1=tex2D(_Tex,((IN.screenPos.xy/IN.screenPos.w).xyxy).xy);
- float4 Add1=Tex2D1.aaaa + float4( -0.5,-0.5,-0.5,-0.5 );
- float4 Multiply0=Add1 * float4( 2,2,2,2 );
- float4 Multiply1=Multiply0 * _DistValue.xxxx;
- float4 Add0=UV_Pan0 + Multiply1;
- float4 Tex2D0=tex2D(_Tex,Add0.xy);
- float4 Multiply4=_ColorFresnel * Tex2D0;
- float4 Fresnel0=(1.0 - dot( normalize( float4( IN.viewDir.x, IN.viewDir.y,IN.viewDir.z,1.0 ).xyz), normalize( float4( IN.sWorldNormal.x, IN.sWorldNormal.y,IN.sWorldNormal.z,1.0 ).xyz ) )).xxxx;
- float4 Lerp0=lerp(Tex2D2,Multiply4,Fresnel0);
- float4 Master0_0_NoInput = float4(0,0,0,0);
- float4 Master0_1_NoInput = float4(0,0,1,1);
- float4 Master0_3_NoInput = float4(0,0,0,0);
- float4 Master0_4_NoInput = float4(0,0,0,0);
- float4 Master0_5_NoInput = float4(1,1,1,1);
- float4 Master0_7_NoInput = float4(0,0,0,0);
- float4 Master0_6_NoInput = float4(1,1,1,1);
- o.Emission = Lerp0;
- o.Normal = normalize(o.Normal);
- }
- ENDCG
- }
- Fallback "Diffuse"
- }
|