Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/Outline" {
  2.     Properties {
  3.         _MainTex ("MainTex", 2D) = "white" {}
  4.         _Outline ("_Outline", Range(1,5)) = 0
  5.         _OutlineClr ("Outline Color", Color) = (1, 1, 0, 1)
  6.     }
  7.     SubShader {
  8.         Pass {
  9.             Tags { "RenderType"="Opaque" }
  10.             ZWrite Off
  11.  
  12.             CGPROGRAM
  13.             #pragma vertex vert
  14.             #pragma fragment frag
  15.             #pragma multi_compile_instancing
  16.             #include "UnityCG.cginc"
  17.  
  18.             half _Outline;
  19.             half4 _OutlineClr;
  20.  
  21.             struct appdata
  22.             {
  23.                 half4 vertex : POSITION;
  24.                 half4 normal : NORMAL;
  25.                 UNITY_VERTEX_INPUT_INSTANCE_ID
  26.             };
  27.  
  28.             struct v2f {
  29.                 half4 pos : SV_POSITION;
  30.                 UNITY_VERTEX_INPUT_INSTANCE_ID
  31.             };
  32.  
  33.             half4 vert(appdata v) : SV_POSITION {
  34.                 v2f o;
  35.                 v.vertex *= _Outline;
  36.                 o.pos = UnityObjectToClipPos(v.vertex);
  37.                 return o.pos;
  38.             }
  39.  
  40.             half4 frag(v2f i) : COLOR {
  41.                 return _OutlineClr;
  42.             }
  43.  
  44.             ENDCG
  45.         }
  46.  
  47.         CGPROGRAM
  48.         #pragma surface surf Lambert noforwardadd exclude_path:prepass nolightmap  
  49.         sampler2D _MainTex;
  50.  
  51.         struct Input {
  52.             half2 uv_MainTex;
  53.         };
  54.  
  55.         void surf(Input IN, inout SurfaceOutput o) {
  56.             o.Albedo = tex2D(_MainTex, IN.uv_MainTex);
  57.         }
  58.  
  59.         ENDCG
  60.     }
  61.     FallBack "Diffuse"
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement