弯弯的月亮 发表于 2015-10-31 10:37

谢谢分享

四九 发表于 2015-10-30 19:02

楼主辛苦啦~谢谢分享

我吃不饱 发表于 2015-10-30 11:14

好资源

angelaa 发表于 2015-10-30 10:26

感觉非常牛逼的样子啊

天马行¤空♂ 发表于 2015-10-29 20:52

kan kan 看的地方额

hoddddky 发表于 2015-10-29 15:01

Shader "MyToon/Toon-Surface_Normal" {
    Properties {
      _MainTex ("Base (RGB)", 2D) = "white" {}
      _Bump ("Bump", 2D) = "bump" {}
      _Ramp ("Ramp Texture", 2D) = "white" {}
      _Tooniness ("Tooniness", Range(0.1,20)) = 4
      _Outline ("Outline", Range(0,1)) = 0.4
    }
    SubShader {
      Tags { "RenderType"="Opaque" }
      LOD 200

      CGPROGRAM
      #pragma surface surf Toon

      sampler2D _MainTex;
      sampler2D _Bump;
      sampler2D _Ramp;
      float _Tooniness;
      float _Outline;

      struct Input {
            float2 uv_MainTex;
            float2 uv_Bump;
            float3 viewDir;
      };

      void surf (Input IN, inout SurfaceOutput o) {
            half4 c = tex2D (_MainTex, IN.uv_MainTex);
            o.Normal = UnpackNormal( tex2D(_Bump, IN.uv_Bump));

            half edge = saturate(dot (o.Normal, normalize(IN.viewDir)));
                        edge = edge < _Outline ? edge/4 : 1;
                       
            o.Albedo = (floor(c.rgb * _Tooniness)/_Tooniness) * edge;
            o.Alpha = c.a;
      }

      half4 LightingToon(SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten)
      {
              float difLight = dot (s.Normal, lightDir);
              float dif_hLambert = difLight * 0.5 + 0.5;
             
              float rimLight = dot (s.Normal, viewDir);
              float rim_hLambert = rimLight * 0.5 + 0.5;
             
              float3 ramp = tex2D(_Ramp, float2(rim_hLambert, dif_hLambert)).rgb;   

                        float4 c;
            c.rgb = s.Albedo * _LightColor0.rgb * ramp * atten * 2;
            c.a = s.Alpha;
            return c;
      }

      ENDCG
    }
    FallBack "Diffuse"
}
Shader "MyToon/Toon-Surface_Normal" {
    Properties {
      _MainTex ("Base (RGB)", 2D) = "white" {}
      _Bump ("Bump", 2D) = "bump" {}
      _Ramp ("Ramp Texture", 2D) = "white" {}
      _Tooniness ("Tooniness", Range(0.1,20)) = 4
      _Outline ("Outline", Range(0,1)) = 0.4
    }
    SubShader {
      Tags { "RenderType"="Opaque" }
      LOD 200

      CGPROGRAM
      #pragma surface surf Toon

      sampler2D _MainTex;
      sampler2D _Bump;
      sampler2D _Ramp;
      float _Tooniness;
      float _Outline;

      struct Input {
            float2 uv_MainTex;
            float2 uv_Bump;
            float3 viewDir;
      };

      void surf (Input IN, inout SurfaceOutput o) {
            half4 c = tex2D (_MainTex, IN.uv_MainTex);
            o.Normal = UnpackNormal( tex2D(_Bump, IN.uv_Bump));

            half edge = saturate(dot (o.Normal, normalize(IN.viewDir)));
                        edge = edge < _Outline ? edge/4 : 1;
                       
            o.Albedo = (floor(c.rgb * _Tooniness)/_Tooniness) * edge;
            o.Alpha = c.a;
      }

      half4 LightingToon(SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten)
      {
              float difLight = dot (s.Normal, lightDir);
              float dif_hLambert = difLight * 0.5 + 0.5;
             
              float rimLight = dot (s.Normal, viewDir);
              float rim_hLambert = rimLight * 0.5 + 0.5;
             
              float3 ramp = tex2D(_Ramp, float2(rim_hLambert, dif_hLambert)).rgb;   

                        float4 c;
            c.rgb = s.Albedo * _LightColor0.rgb * ramp * atten * 2;
            c.a = s.Alpha;
            return c;
      }

      ENDCG
    }
    FallBack "Diffuse"
}

Shader "MyToon/Toon-Surface_Normal" {
    Properties {
      _MainTex ("Base (RGB)", 2D) = "white" {}
      _Bump ("Bump", 2D) = "bump" {}
      _Ramp ("Ramp Texture", 2D) = "white" {}
      _Tooniness ("Tooniness", Range(0.1,20)) = 4
      _Outline ("Outline", Range(0,1)) = 0.4
    }
    SubShader {
      Tags { "RenderType"="Opaque" }
      LOD 200

      CGPROGRAM
      #pragma surface surf Toon

      sampler2D _MainTex;
      sampler2D _Bump;
      sampler2D _Ramp;
      float _Tooniness;
      float _Outline;

      struct Input {
            float2 uv_MainTex;
            float2 uv_Bump;
            float3 viewDir;
      };

      void surf (Input IN, inout SurfaceOutput o) {
            half4 c = tex2D (_MainTex, IN.uv_MainTex);
            o.Normal = UnpackNormal( tex2D(_Bump, IN.uv_Bump));

            half edge = saturate(dot (o.Normal, normalize(IN.viewDir)));
                        edge = edge < _Outline ? edge/4 : 1;
                       
            o.Albedo = (floor(c.rgb * _Tooniness)/_Tooniness) * edge;
            o.Alpha = c.a;
      }

      half4 LightingToon(SurfaceOutput s, fixed3 lightDir, half3 viewDir, fixed atten)
      {
              float difLight = dot (s.Normal, lightDir);
              float dif_hLambert = difLight * 0.5 + 0.5;
             
              float rimLight = dot (s.Normal, viewDir);
              float rim_hLambert = rimLight * 0.5 + 0.5;
             
              float3 ramp = tex2D(_Ramp, float2(rim_hLambert, dif_hLambert)).rgb;   

                        float4 c;
            c.rgb = s.Albedo * _LightColor0.rgb * ramp * atten * 2;
            c.a = s.Alpha;
            return c;
      }

      ENDCG
    }
    FallBack "Diffuse"
}




淚色 发表于 2015-10-29 14:05

看看

rockystar999 发表于 2015-10-28 18:06

需要学习一下

addy131204 发表于 2015-10-28 14:51

查看一下学习学习一下

留耳 发表于 2015-10-26 17:44

谢谢分享

页: 160 161 162 163 164 165 166 167 168 169 [170] 171 172 173 174 175 176 177 178 179
查看完整版本: 非常牛逼的2个外发光shader!~~~~~~~~~~