Advertisement
Guest User

Untitled

a guest
Oct 4th, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
  2.  
  3. Shader "Nature/Terrain/Diffuse" {
  4.     Properties {
  5.         [HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
  6.         [HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
  7.         [HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
  8.         [HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
  9.         [HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {}
  10.         [HideInInspector] _Normal3 ("Normal 3 (A)", 2D) = "bump" {}
  11.         [HideInInspector] _Normal2 ("Normal 2 (B)", 2D) = "bump" {}
  12.         [HideInInspector] _Normal1 ("Normal 1 (G)", 2D) = "bump" {}
  13.         [HideInInspector] _Normal0 ("Normal 0 (R)", 2D) = "bump" {}
  14.         // used in fallback on old cards & base map
  15.         [HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {}
  16.         [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1)
  17.     }
  18.  
  19.     CGINCLUDE
  20.         #pragma surface surf Lambert vertex:SplatmapVert finalcolor:SplatmapFinalColor finalprepass:SplatmapFinalPrepass finalgbuffer:SplatmapFinalGBuffer noinstancing
  21.         #pragma multi_compile_fog
  22.         #include "TerrainSplatmapCommon.cginc"
  23.  
  24.         void surf(Input IN, inout SurfaceOutput o)
  25.         {
  26.             half4 splat_control;
  27.             half weight;
  28.             fixed4 mixedDiffuse;
  29.             SplatmapMix(IN, splat_control, weight, mixedDiffuse, o.Normal);
  30.             o.Albedo = mixedDiffuse.rgb;
  31.             o.Alpha = weight;
  32.         }
  33.     ENDCG
  34.  
  35.     Category {
  36.         Tags {
  37.             "Queue" = "Geometry-99"
  38.             "RenderType" = "Opaque"
  39.         }
  40.         // TODO: Seems like "#pragma target 3.0 _TERRAIN_NORMAL_MAP" can't fallback correctly on less capable devices?
  41.         // Use two sub-shaders to simulate different features for different targets and still fallback correctly.
  42.         SubShader { // for sm3.0+ targets
  43.             CGPROGRAM
  44.                 #pragma target 3.0
  45.                 #pragma multi_compile __ _TERRAIN_NORMAL_MAP
  46.             ENDCG
  47.         }
  48.         SubShader { // for sm2.0 targets
  49.             CGPROGRAM
  50.             ENDCG
  51.         }
  52.     }
  53.  
  54.     Dependency "AddPassShader" = "Hidden/TerrainEngine/Splatmap/Diffuse-AddPass"
  55.     Dependency "BaseMapShader" = "Diffuse"
  56.     Dependency "Details0"      = "Hidden/TerrainEngine/Details/Vertexlit"
  57.     Dependency "Details1"      = "Hidden/TerrainEngine/Details/WavingDoublePass"
  58.     Dependency "Details2"      = "Hidden/TerrainEngine/Details/BillboardWavingDoublePass"
  59.     Dependency "Tree0"         = "Hidden/TerrainEngine/BillboardTree"
  60.  
  61.     Fallback "Diffuse"
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement