Advertisement
Guest User

Untitled

a guest
Oct 4th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/ToonTerrainFirstPass" {
  2.     Properties {
  3.         [HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
  4.         [HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
  5.         [HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
  6.         [HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
  7.         [HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {}
  8.         [HideInInspector] _Normal3 ("Normal 3 (A)", 2D) = "bump" {}
  9.         [HideInInspector] _Normal2 ("Normal 2 (B)", 2D) = "bump" {}
  10.         [HideInInspector] _Normal1 ("Normal 1 (G)", 2D) = "bump" {}
  11.         [HideInInspector] _Normal0 ("Normal 0 (R)", 2D) = "bump" {}
  12.         // used in fallback on old cards & base map
  13.         [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
  14.         [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
  15.  
  16.  
  17.         // TOON STUFF START
  18.         //TOONY COLORS
  19.         _Color ("Color", Color) = (1.0,1.0,1.0,1.0)
  20.         _HColor ("Highlight Color", Color) = (0.6,0.6,0.6,1.0)
  21.         _SColor ("Shadow Color", Color) = (0.4,0.4,0.4,1.0)
  22.        
  23.         //DIFFUSE
  24.         _MainTex ("Main Texture (RGB) Spec/Refl Mask (A) ", 2D) = "white" {}
  25.        
  26.         //TOONY COLORS RAMP
  27.         _Ramp ("#RAMPT# Toon Ramp (RGB)", 2D) = "gray" {}
  28.         _RampThreshold ("#RAMPF# Ramp Threshold", Range(0,1)) = 0.5
  29.         _RampSmooth ("#RAMPF# Ramp Smoothing", Range(0.01,1)) = 0.1
  30.        
  31.         //BUMP
  32.         _BumpMap ("#NORM# Normal map (RGB)", 2D) = "bump" {}
  33.         // TOON STUFF END
  34.     }
  35.  
  36.     SubShader {
  37.       Tags {
  38.             "Queue" = "Geometry-99"
  39.             "RenderType" = "Opaque"
  40.         }
  41.         LOD 200
  42.  
  43.  
  44.         CGPROGRAM
  45.         #pragma surface surf ToonyColors vertex:SplatmapVert finalcolor:SplatmapFinalColor finalprepass:SplatmapFinalPrepass finalgbuffer:SplatmapFinalGBuffer noinstancing
  46.         #pragma multi_compile_fog
  47.         #include "TerrainSplatmapCommon.cginc"
  48.             //TOON STUFF START
  49.                 #include "Include/TCP2_Include.cginc"      
  50.                 #pragma glsl
  51.                 #pragma shader_feature TCP2_RAMPTEXT
  52.                 #pragma shader_feature TCP2_BUMP
  53.                 #pragma shader_feature TCP2_LIGHTMAP
  54.  
  55.             //================================================================
  56.             // VARIABLES
  57.  
  58.  
  59.             fixed4 _Color;
  60.             sampler2D _MainTex;
  61.        
  62.             #if TCP2_BUMP
  63.             sampler2D _BumpMap;
  64.             #endif
  65.        
  66.             struct Input
  67.             {
  68.                 half2 uv_MainTex : TEXCOORD0;
  69.             #if TCP2_BUMP
  70.                 half2 uv_BumpMap : TEXCOORD1;
  71.             #endif
  72.             };
  73.             //TOON STUF END
  74.  
  75.         void surf(Input IN, inout SurfaceOutput o)
  76.         {
  77.             half4 splat_control;
  78.             half weight;
  79.             fixed4 mixedDiffuse;
  80.             SplatmapMix(IN, splat_control, weight, mixedDiffuse, o.Normal);
  81.             o.Albedo = mixedDiffuse.rgb;
  82.             o.Alpha = weight;
  83.  
  84.             half4 c = tex2D(_MainTex, IN.uv_MainTex);
  85.             o.Albedo = c.rgb * _Color.rgb;
  86.             o.Alpha = c.a * _Color.a;
  87.  
  88.             #if TCP2_BUMP
  89.             //Normal map
  90.             o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
  91.             #endif
  92.         }
  93.     ENDCG
  94.     } // End SubShader
  95.  
  96.  
  97.     Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Diffuse-AddPass"
  98.     Dependency "BaseMapShader" = "Animmal/ToonTerrainBase"
  99.     Dependency "Details0"      = "Hidden/TerrainEngine/Details/Vertexlit"
  100.     Dependency "Details1"      = "Hidden/TerrainEngine/Details/WavingDoublePass"
  101.     Dependency "Details2"      = "Hidden/TerrainEngine/Details/BillboardWavingDoublePass"
  102.     Dependency "Tree0"         = "Hidden/TerrainEngine/BillboardTree"
  103.  
  104.     Fallback "Diffuse"
  105.  
  106.  
  107. } // Ehd Shader
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement