Advertisement
Guest User

FirstPass

a guest
Jan 2nd, 2018
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.32 KB | None | 0 0
  1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
  2.  
  3. Shader "Nature/Terrain/Standard" {
  4.     Properties {
  5.         // set by terrain engine
  6.         [HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
  7.         [HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
  8.         [HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
  9.         [HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
  10.         [HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {}
  11.         [HideInInspector] _Normal3 ("Normal 3 (A)", 2D) = "bump" {}
  12.         [HideInInspector] _Normal2 ("Normal 2 (B)", 2D) = "bump" {}
  13.         [HideInInspector] _Normal1 ("Normal 1 (G)", 2D) = "bump" {}
  14.         [HideInInspector] _Normal0 ("Normal 0 (R)", 2D) = "bump" {}
  15.         [HideInInspector] [Gamma] _Metallic0 ("Metallic 0", Range(0.0, 1.0)) = 0.0
  16.         [HideInInspector] [Gamma] _Metallic1 ("Metallic 1", Range(0.0, 1.0)) = 0.0
  17.         [HideInInspector] [Gamma] _Metallic2 ("Metallic 2", Range(0.0, 1.0)) = 0.0
  18.         [HideInInspector] [Gamma] _Metallic3 ("Metallic 3", Range(0.0, 1.0)) = 0.0
  19.         [HideInInspector] _Smoothness0 ("Smoothness 0", Range(0.0, 1.0)) = 1.0
  20.         [HideInInspector] _Smoothness1 ("Smoothness 1", Range(0.0, 1.0)) = 1.0
  21.         [HideInInspector] _Smoothness2 ("Smoothness 2", Range(0.0, 1.0)) = 1.0
  22.         [HideInInspector] _Smoothness3 ("Smoothness 3", Range(0.0, 1.0)) = 1.0
  23.  
  24.         // used in fallback on old cards & base map
  25.         [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
  26.         [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
  27.     }
  28.  
  29.     SubShader {
  30.         Tags {
  31.             "Queue" = "Geometry-100"
  32.             "RenderType" = "Opaque"
  33.         }
  34.  
  35.         CGPROGRAM
  36.         #pragma surface surf Standard vertex:SplatmapVert finalcolor:SplatmapFinalColor finalgbuffer:SplatmapFinalGBuffer fullforwardshadows noinstancing
  37.         #pragma multi_compile_fog
  38.         #pragma target 3.0
  39.         // needs more than 8 texcoords
  40.         #pragma exclude_renderers gles psp2
  41.         #include "UnityPBSLighting.cginc"
  42.  
  43.         #pragma multi_compile __ _TERRAIN_NORMAL_MAP
  44.  
  45.         #define TERRAIN_STANDARD_SHADER
  46.         #define TERRAIN_SURFACE_OUTPUT SurfaceOutputStandard
  47.         #include "TerrainSplatmapCommon.cginc"
  48.  
  49.         half _Metallic0;
  50.         half _Metallic1;
  51.         half _Metallic2;
  52.         half _Metallic3;
  53.  
  54.         half _Smoothness0;
  55.         half _Smoothness1;
  56.         half _Smoothness2;
  57.         half _Smoothness3;
  58.  
  59.         void surf (Input IN, inout SurfaceOutputStandard o) {
  60.             half4 splat_control;
  61.             half weight;
  62.             fixed4 mixedDiffuse;
  63.             half4 defaultSmoothness = half4(_Smoothness0, _Smoothness1, _Smoothness2, _Smoothness3);
  64.             SplatmapMix(IN, defaultSmoothness, splat_control, weight, mixedDiffuse, o.Normal);
  65.             o.Albedo = mixedDiffuse.rgb;
  66.             o.Alpha = weight;
  67.             o.Smoothness = mixedDiffuse.a;
  68.             o.Metallic = dot(splat_control, half4(_Metallic0, _Metallic1, _Metallic2, _Metallic3));
  69.         }
  70.         ENDCG
  71.     }
  72.  
  73.     Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Standard-AddPass"
  74.     Dependency "BaseMapShader" = "Hidden/TerrainEngine/Splatmap/Standard-Base"
  75.  
  76.     Fallback "Nature/Terrain/Diffuse"
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement