Guest User

Untitled

a guest
Mar 11th, 2020
38
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Chams" {
  2. Properties {
  3. _OutlineColor ("Outline Color", Color) = (0.000000,0.000000,0.000000,1.000000)
  4. _Outline ("Outline width", Range(0.000000,0.030000)) = 0.005000
  5. }
  6. SubShader {
  7. Tags { "QUEUE"="Transparent" }
  8. Pass {
  9. Name "BASE"
  10. Tags { "QUEUE"="Transparent" }
  11. Blend Zero One
  12. CGPROGRAM
  13. #pragma vertex vert
  14. #pragma fragment frag
  15. #pragma target 2.0
  16. #include "UnityCG.cginc"
  17. #pragma multi_compile_fog
  18. #define USING_FOG (defined(FOG_LINEAR) || defined(FOG_EXP) || defined(FOG_EXP2))
  19.  
  20. // uniforms
  21. float4 _OutlineColor_ST;
  22.  
  23. // vertex shader input data
  24. struct appdata {
  25. float3 pos : POSITION;
  26. float3 uv0 : TEXCOORD0;
  27. UNITY_VERTEX_INPUT_INSTANCE_ID
  28. };
  29.  
  30. // vertex-to-fragment interpolators
  31. struct v2f {
  32. fixed4 color : COLOR0;
  33. float2 uv0 : TEXCOORD0;
  34. #if USING_FOG
  35. fixed fog : TEXCOORD1;
  36. #endif
  37. float4 pos : SV_POSITION;
  38. UNITY_VERTEX_OUTPUT_STEREO
  39. };
  40.  
  41. // vertex shader
  42. v2f vert (appdata IN) {
  43. v2f o;
  44. UNITY_SETUP_INSTANCE_ID(IN);
  45. UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
  46. half4 color = half4(0,0,0,1.1);
  47. float3 eyePos = mul (UNITY_MATRIX_MV, float4(IN.pos,1)).xyz;
  48. half3 viewDir = 0.0;
  49. o.color = saturate(color);
  50. // compute texture coordinates
  51. o.uv0 = IN.uv0.xy * _OutlineColor_ST.xy + _OutlineColor_ST.zw;
  52. // fog
  53. #if USING_FOG
  54. float fogCoord = length(eyePos.xyz); // radial fog distance
  55. UNITY_CALC_FOG_FACTOR_RAW(fogCoord);
  56. o.fog = saturate(unityFogFactor);
  57. #endif
  58. // transform position
  59. o.pos = UnityObjectToClipPos(IN.pos);
  60. return o;
  61. }
  62.  
  63. // textures
  64. sampler2D _OutlineColor; // not in shader properties, assuming 2D
  65.  
  66. // fragment shader
  67. fixed4 frag (v2f IN) : SV_Target {
  68. fixed4 col;
  69. fixed4 tex, tmp0, tmp1, tmp2;
  70. // SetTexture #0
  71. tex = tex2D (_OutlineColor, IN.uv0.xy);
  72. col = fixed4(0,0,0,0);
  73. // fog
  74. #if USING_FOG
  75. col.rgb = lerp (unity_FogColor.rgb, col.rgb, IN.fog);
  76. #endif
  77. return col;
  78. }
  79.  
  80. // texenvs
  81. //! TexEnv0: 01020000 01020000 [_OutlineColor] [00000000]
  82. ENDCG
  83. }
  84. Pass {
  85. Name "OUTLINE"
  86. Tags { "LIGHTMODE"="ALWAYS" "QUEUE"="Transparent" }
  87. Cull Front
  88. Blend One OneMinusDstColor
  89. CGPROGRAM
  90. #line 67 ""
  91. #ifdef DUMMY_PREPROCESSOR_TO_WORK_AROUND_HLSL_COMPILER_LINE_HANDLING
  92. #endif
  93.  
  94. #include "HLSLSupport.cginc"
  95. #define UNITY_INSTANCED_LOD_FADE
  96. #define UNITY_INSTANCED_SH
  97. #define UNITY_INSTANCED_LIGHTMAPSTS
  98. #include "UnityShaderVariables.cginc"
  99. #include "UnityShaderUtilities.cginc"
  100. #line 10
  101.  
  102. #include "UnityCG.cginc"
  103.  
  104. struct appdata {
  105. float4 vertex : POSITION;
  106. float3 normal : NORMAL;
  107. };
  108.  
  109. struct v2f {
  110. float4 pos : POSITION;
  111. float4 color : COLOR;
  112. };
  113.  
  114. uniform float _Outline;
  115. uniform float4 _OutlineColor;
  116.  
  117. v2f vert(appdata v) {
  118. // just make a copy of incoming vertex data but scaled according to normal direction
  119. v2f o;
  120. o.pos = UnityObjectToClipPos(v.vertex);
  121.  
  122. float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
  123. float2 offset = TransformViewToProjection(norm.xy);
  124.  
  125. o.pos.xy += offset * o.pos.z * _Outline;
  126. o.color = _OutlineColor;
  127. return o;
  128. }
  129. #line 67 ""
  130. #ifdef DUMMY_PREPROCESSOR_TO_WORK_AROUND_HLSL_COMPILER_LINE_HANDLING
  131. #endif
  132. /* UNITY: Original start of shader */
  133. #pragma vertex vert
  134. #pragma fragment frag
  135.  
  136. half4 frag(v2f i) :COLOR {
  137. return i.color;
  138. }
  139. ENDCG
  140. }
  141. }
  142. Fallback "Diffuse"
  143. }
RAW Paste Data